Avoid autoselect in combobox

T

Tor Inge Rislaa

Avoid autoselect in combobox

In the load procedure of a form I am filling a combobox with data from a
database. The combobox fill the data OK, but it is automatic showing the
first item of the list as the text. How can I avoid the first item in the
list to be selected as default? I want the textbox of the combo to be left
empty until the user select an item.


My Code below:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MyDataAdapter.SelectCommand.CommandText = "SELECT MyDescription, MyID
FROM MyTable"
MyDataAdapter.Fill(MyDataSet)
ComboBox1.DataSource = MyDataSet
ComboBox1.DisplayMember = "MyTable.MyDescription"
ComboBox1.ValueMember = "MyTable.MyID"

End Sub

T.I.Rislaa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top