Why do my comboboxes display a value instead of being blank until a value is chosen from dropdown?

I'm rewriting a MSAccess application to VB.NET for more functionality.  I have come a long way with my understanding
but I'm puzzled with what is probably a simple fix for VB.NET novices.

I have a "Clear / New" button on a form for initializing all fields on the form in preparation for data entry of new record.
I have several combo boxes that are required fields and several that are not.  I do not want any of the combo boxes to
display a value until the user click's the dropdown and choses value.  Why do they all contain the first value from the
datatable instead of being blank...AND...more importantly, how do I clear these values until the control is chosen?

Below is my code in various parts:

Public daContacts As New System.Data.OleDb.OleDbDataAdapter
Public dsContacts As New DataSet
Public dtContacts1 As New DataTable
Public dtContacts2 As New DataTable
Public arrMrMrs() As String = {"Mr.", "Mrs.", "Ms.", "Dr."}

daContacts.SelectCommand = New System.Data.OleDb.OleDbCommand("SELECT * FROM Contacts ORDER BY ContactName", TSFConnection)
dtContacts1 = dsContacts.Tables(0)
dtContacts2 = dsContacts.Tables(0)

cmboBuyer.DataSource = dtContacts1
cmboBuyer.ValueMember = "RecID"
cmboBuyer.DisplayMember = "ContactName"

cmboSeller.DataSource = dtContacts2
cmboSeller.ValueMember = "RecID"
cmboSeller.DisplayMember = "ContactName"

cmboMrMrs.DataSource = arrMrMrs
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried Combobox1.Text=""

That ought to clear it for you
oh... and one more thing... Use

        ComboBox1.Text = ""
        ComboBox1.SelectedIndex = -1 '(Meaning NO item should be selected)

Just to make sure that nothing is selected in the Combobox1... Since It will maintain any selection even if Combobox1.Text =""
TSFLLCAuthor Commented:
I found both of these answers previously and neither one of them worked because they are bound to a datatable.

I did find this piece of code and it does work.
However, I don't like it for (2) reasons:

1) An inordinate amount of code to clear a field.
2) An empty first record when you click on the dropdown.

But it does work....maybe someone else has a better way.

        Dim dr As DataRow
        dr = dsContacts1.Tables(0).NewRow
        dr.Item("ContactIndex") = ""
        dsContacts1.Tables(0).Rows.InsertAt(dr, 0)

        dr = dsContacts2.Tables(0).NewRow
        dr.Item("ContactIndex") = ""
        dsContacts2.Tables(0).Rows.InsertAt(dr, 0)

        cmboSeller.SelectedIndex = 0
        cmboBuyer.SelectedIndex = 0

In MS Access, even though you have a datasource of a SQL statement......
It is simply a matter of cmboseller.text = "" to resolve the problem.

TSFLLCAuthor Commented:
OOPS!   Where I wrote 'ContactIndex'....I meant 'ContactName'
After I set a datasource, when I set the ComboBox's SelectedIndex = -1, and no value is chosen - depending on the type of ComboBox you've chosen...  If the user must select a value (DropDownStyle=DropDownList), than I don't think there's another way.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.