Ricavare i valori selezionati da un ListBox bindato
Si supponga di avere un ListBox a multiselezione su cui si è impostato DataSource, ValueMember e DisplayMember. Per ricavare i ValueMember selezionati basta notare che in questo caso gli Items sono dei DataRowView. For index As Integer = 0 To Me.ListBox1.SelectedIndices.Count – 1 With DirectCast(Me.ListBox1.Items(Me.ListBox1.SelectedIndices(index)), _ System.Data.DataRowView) MsgBox(.Row(Me.ListBox1.ValueMember).ToString) End With Next