Salve ragazzi!
Visualizzo in output value e key, ma io vorrei visualizzare solo ValueMember
questo è il mio Output in label: [1,Sabbia]
vorrei visualizzare solo 1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cmbSource As New Dictionary(Of String, String)()
ComboBox1.Items.Clear()
cmbSource.Add("1", "Sabbia")
cmbSource.Add("2", "Cemento")
cmbSource.Add("3", "Calce")
ComboBox1.DataSource = New BindingSource(cmbSource, Nothing)
ComboBox1.DisplayMember = "Value"
ComboBox1.ValueMember = "Key"
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Label1.Text = ComboBox1.SelectedItem.ToString
End Sub