I have a Form with a Multilined textBox.
With the code below that I use in a buttoncontrol, I try to select these indexes.
When pressing the button, no selection can be seen but when I click on the area
where it should be selected, it ´blincs´ very fast and you can see that the area
was selected.
I wonder why you cant see it. You must click the area but then it dissapear on the same time.
I tried to put Application:: DoEvents() before to activate the Form but this didn´t help.

Application::DoEvents();
richTextBox1->Select( 0, 30);

I noticed a difference. If I put this code in a ToolStripMenuItem_Click, then the area is selected.
But if I create a button on the form and put the same code in it, then it doesn´t work. :icon_confused:

richTextBox1->Select( 0, 30);

You might want to set the HideSelection property of the RichTextBox to false.

It worked. I red about it so something like this:

´When this property is set to false, selected nodes in the TreeView control remain highlighted in a different color than the current selection color when the TreeView control loses focus.´

You might want to set the HideSelection property of the RichTextBox to false.

It worked. I red about it so something like this:

´When this property is set to false, selected nodes in the TreeView control remain highlighted in a different color than the current selection color when the TreeView control loses focus.´

Just a note, you've been reading the TreeView control documentation. In general, try to be as accurate as you can i.e. reading the RichTextBox documentation in this case.

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.