Populate Combos from DB and leave empty item
Posted on 2006-10-27
I am populating some combos from an access db but when they are populated the first record of the table is visible. How can i make this blank or have text such as [Enter User Name].
Code for populating combos:
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\ITAssets.mdb")
Dim UserAdapter As New OleDbDataAdapter("SELECT Name FROM tblUsers", conn)
Dim UserDT As New DataTable("tblUsers")
Call UserAdapter.Fill(UserDT) 'Execute SQL above and fill data table with records.
'Populate Combo Boxes
cboUser.DataSource = UserDT
I have tried adding a blank record to the DB and that sort of works but leaves a blank record as a choice.