Text is selected when combobox dropdown style
I have a problem with a list of windows in dropdown style. combox contains two values - "hello" and "hello". I want to show the default value for my combobox window is "Hello" when the page is loaded. Now when the style is DropDown, it selects all the text ("hello"), which creates confusion between the first and third control (since the focus is on the first control (textbox), but it looks like that focus is on the third control, which is a combbox). can anyone tell me how to solve it?
I think you are saying that you have a text box and a combo box. When the form loads, the combobox receives a "hello" (first item). Also, the actual focus is on the textbox when the form loads, so if the user launches the app and starts typing, the text goes to the textbox, but all the text in the combo box is highlighted, so it looks like the user is typing go to the box with a list box and not into the textbox where it really ends.
Does this describe your problem?
If so, I think you can use the following in the from_load () method:
comboBox1.SelectedIndex = 0; // Select first item in combo.
// Uncomment next line if you want no text selected in the
// text box and the insertion point and end of textbox text.
//textBox1.Select(textBox1.Text.Length, 0);
textBox1.Select(); // Select the textbox.
source to share