Abhith
Abhith

Reputation: 306

How to Make combobox first item style as selected so that typing will overwrite that item

What i wanted is after binding combobox, the first item ( first item will be always header like 'Select Item') need to be in selected style, means the blue back color and typing will overwrite that item (autocomplete starts then).

dropdownstyle is dropdown so that user can type inside combobox.

Wanted like thiswanted like this

Upvotes: 0

Views: 290

Answers (2)

Alfee
Alfee

Reputation: 11

There are two methods :

comboBox1.Focus();

or

comboBox1.select(0, comboBox1.text.Length);

Upvotes: 0

Dan Terkildsen
Dan Terkildsen

Reputation: 337

When the combobox gets focus the text will be selected automatically.
If you want the combobox to get focus right after the binding you can use

ComboBox1.DataSource = oDataSource
ComboBox1.Focus()

Upvotes: 2

Related Questions