Devi lavorarci un pò
Nel codice (1) trovi un esempio di una classe diciamo dataitem
che aggiungeremo alla combobox come item
leggerai i dati del datatable o altra fonte (2).
(1)
Public Class DataItem
Private _id As Integer
Private _value As String
Public Sub New(ByVal id As Integer, ByVal value As String)
_id = id
_value = value
End Sub
Public ReadOnly Property ID() As Integer
Get
Return _id
End Get
End Property
Public ReadOnly Property Value() As String
Get
Return _value
End Get
End Property
Public Overrides Function ToString() As String
Return Value
End Function
End Class
(2)
......
......
''''''''' LEGGO I DATI mettimo da un datatable "mydatatable"
For row As DataRow in mydatatable.Rows
ComboBox1.Items.Add(New DataItem(row(0), row(1)))
Next
..........