I have a question. Can i select a string from my RichTextBox ?

For example:

I have this text:

English
Francais
Spaniol

And i want to select Francais , but as string , not at int - lenght ... ( richTextBox1.Select(7,15); )

I want something like:

richTextBox1.SelectString("Francais") , is there something like this ?

I've used richtextbox a little bit, and well u can use richtextbox1.Select(7,12) (or whatever), but sometimes you wouldn't know where it ism so u could search the whole text thats in the richtextbox for the word your looking for,,,,and i wrote "Francais".Length, just incase its a variable, not a constant word...if it is u can use that or u can count it ur self ^^...lol

if (richTextBox1.Text.Contains("Francais"))
{
         int index=richTextBox1.Text.IndexOf("Francais");
         richTextBox1.Select(index, "Francais".Length);
         string retrieve_text = richTextBox1.SelectedText;
}

there might be another way...there might not,,,,,,but this should work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.