I have a form containing a TextBox
in C# which I set to a string as follows:
textBox.Text = str;
When the form is displayed, why does the text in the texbox appear highlighted/selected?
The text box has a TabIndex
of 0 and TabStop
set to true. This means that the control will be given focus when the form is displayed.
You can either give another control the 0 TabIndex
(if there is one) and give the text box a different tab index (>0), or set TabStop
to false for the text box to stop this from happening.