asked on
'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