I have taken over a project where a listbox is to be filled with values from a dataset object that has three columns through it's tableadapter
Prod_ID Prod_Decscrption ON_Hand
I've tested the table adapter, and it does return values.
But I can not figure out how to populate the listbox on my form,
I'm sure it's something simple, but I'm not seeing it.
Dim objdataadapter As New SqlDataAdapter
Dim objcommand As New SqlCommand
Dim objdatatable As New DataTable
Dim objdataset As New DataSet
Dim objconn As New SqlConnection
Dim nrow As Integer
Dim strselect As String
strselect = "Select * from table1"
objconn = New SqlConnection("Server=localhost; DataBase=yourdbase; User ID=sa; pwd=")
objdataadapter.SelectCommand = New SqlCommand(strselect, objconn)
objdataadapter.Fill(objdataset)
objdatatable = objdataset.Tables(0)
For nrow = 0 To objdatatable.Rows.Count - 1
ListBox1.Items.Add(objdatatable.Rows(nrow).Item("y our field"))
Next