Selecting text

What I want to do may not be possible, but I'll ask anyway:

The Syntax on MS.com
 
richTextBox1->Select (int start, int length);


What I am wanting to do is:
 
richTextBox1->Text->Select (textBox1->Text);


But I don't understand why MS.com is talking about int(s). I'm wanting to highlight strings of data.

EXAMPLE:
//-----------------------------
//This is richTextBox1->Text
// this is a line TNG
// TNG likes cplusplus.com
// Where is the TNG
// I'm wanting to highligh 'TNG'
//-----------------------------

textBox1->Text = "TNG"
Click_Button

//Every Instance of "TNG" is highlighted.
But I don't understand why MS.com is talking about int(s).


It's positions.

If you have the string "0123456789" and you do Select(2,3);, then "234" will be selected. (3 characters, starting with index 2)

I'm not sure whether or not you can select multiple non-contiguous sections. You probably can -- just call Select() multiple times for each section you want to highlight.
Last edited on
But I'm not sure what the position is. How would I do that?

If some copy and pasted the Constitution (for example), and wanted to find all the letter "A"s. how would that work? Or is it possible? I'm wanting to allow the user to put whatever they are looking for in textBox1 and on button click have it all selected.
This nothing seems to be working.
Topic archived. No new replies allowed.