how to determine what the select txt is ?

  • Thread starter Thread starter Aussie Rules
  • Start date Start date
A

Aussie Rules

Hi,

I want to be able to show a txt file(stored on disk) to the end user in some
sort of txt editor control, and allow the user to highlight/select words
within the text.

Once they have selected some words or txt I want to be able to have my
application know what line and position the selected text is.

I would figure that I would need either the RTF text control or a third
party txt control. (I can't rely on the user having MS word).

Is there a good txt control I could buy that would have this sort of
functionality ?

Thanks
 
Hi,

I want to be able to show a txt file(stored on disk) to the end user in some
sort of txt editor control, and allow the user to highlight/select words
within the text.

Once they have selected some words or txt I want to be able to have my
application know what line and position the selected text is.

I would figure that I would need either the RTF text control or a third
party txt control. (I can't rely on the user having MS word).

Is there a good txt control I could buy that would have this sort of
functionality ?

Thanks

Hi Aussie,
You can do similar thing within your application using RichTextBox's
"SelectionStart" and "SelectionLength" properties. For example, if you
want to highlight a text on richtextbox, i've done this with hoping to
work for you:

' Assuming you have some text in richtextbox placed on a form named
form2
Form2.FindMyText("textToSearch", Form2.RichTextBox1.SelectionStart +
Form2.RichTextBox1.SelectionLength)
Form2.Activate()

Thanks,

Onur Güzel
 
Hi Aussie,
You can do similar thing within your application using RichTextBox's
"SelectionStart" and "SelectionLength" properties. For example, if you
want to highlight a text on richtextbox, i've done this with hoping to
work for you:

' Assuming you have some text in richtextbox placed on a form named
form2
Form2.FindMyText("textToSearch", Form2.RichTextBox1.SelectionStart +
Form2.RichTextBox1.SelectionLength)
Form2.Activate()

Thanks,

Onur Güzel

Forgot to mention:
After selecting the text within richtextbox, copy it to clipboard to
be available for any application using;

Clipboard.SetText(Form1.RichTextBox1.SelectedText)

Thanks,

Onur Güzel
 
Thanks for your replies.

What I am trying to do is not get the selected text, but the position of the
text.

Basiclly I am trying to open a file and have the user select say the
customer ID in the file. That would be say on line 4, position 10 to 15.

I want to be able to know the location, so that more files of the same
format can be then processed and have the customer ID extracted based onthe
location.

Hope that make sense

Again, thanks for your replies.

Hi Aussie,
You can do similar thing within your application using RichTextBox's
"SelectionStart" and "SelectionLength" properties. For example, if you
want to highlight a text on richtextbox, i've done this with hoping to
work for you:

' Assuming you have some text in richtextbox placed on a form named
form2
Form2.FindMyText("textToSearch", Form2.RichTextBox1.SelectionStart +
Form2.RichTextBox1.SelectionLength)
Form2.Activate()

Thanks,

Onur Güzel

Forgot to mention:
After selecting the text within richtextbox, copy it to clipboard to
be available for any application using;

Clipboard.SetText(Form1.RichTextBox1.SelectedText)

Thanks,

Onur Güzel
 
Back
Top