i create form with TextBox on it. Text box have a ReadOnly true propertiy. when i add text to text box. all text inside the text box is selected. how i can rid that. i tried to change value of SelectionLength, SelectionStart, SelectedText properties but that did not help. I Use VC# 2008 express.
After you set the text, clear the selection:
textBox1.Text += "String" + Environment.NewLine + "String";
textBox1.Select(0, 0);
SelectionLength will be 0 until after the TextBox receives focus, which explains why setting that property did not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With