'create a table object
Dim dt As New DataTable
'create two columns
dt.Columns.Add("SoftwareID", GetType(System.Int32))
dt.Columns.Add("Title", GetType(System.String))
' add select columns from a table in the dataset to dt
For Each r In WSCGSoftwareDataSet.Tables(0).Rows
dt.Rows.Add(New Object() {r(0), r(1)})
Next
' add dt to listbox datasource
ListBox1.DataSource = dt
' identify display and value members of the listbox
ListBox1.DisplayMember = "Title"
ListBox1.ValueMember = "SoftwareID"
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
MessageBox.Show(ListBox1.ValueMember.ToString())
End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.