OK, I've exhausted my searching, so if someone can point me to a link with a good example, that would be super.
I'm simply trying populate a combobox with data from an Access table (it's a simple contact list with Name and Number). Every example I find and try, I get something that goes wrong. I can get the table imported with a SINGLE column, but need both columns displayed with the selected choice being the number column.
Sub FillComboBox() Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=contacts.accdb") Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM ContactData ORDER BY ContactName ASC", con) con.Open() Dim sdr As OleDbDataReader = cmd.ExecuteReader While sdr.Read() cbo_To.Items.Add(sdr.Item("ContactName").ToString) End While con.Close() con = Nothing End Sub
I can concatenate with something like cbo_To.Items.Add(sdr.Item("ContactName").ToString + " " + sdr.Item("ContactNumber".ToString)), but I really only want the Number in the field.