How to change dropdownstyle on focus?
When control is in focus I want to have style simple, but when a user start typing text i want to change it into dropdownlist. So he can type only what is in list.
I'm not sure why it does that, although I never found it problematic as a
ComboBox isn't a TextBox even though you can sometimes write in it. You can
however override the selection in the focus/enter events, but unless you keep
track of the cursor position the cursor will for the ComboBox always be at
the end.
void comboBox1_GotFocus(object sender, EventArgs e)
{
comboBox1.SelectionStart = comboBox1.Text.Length;
}
void textBox1_Enter(object sender, EventArgs e)
{
textBox1.SelectAll();
}
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks