Fill ComboBox from ArrayList VB.Net

'Dim data as ArrayList = new ArrayList
' data is 2d arraylist
' cmbMain is ComboBox

Dim choices = New Dictionary(Of String, String)()

For i As Integer = 0 To data.Count - 1
choices(data.Item(i).Item(0)) = data.Item(i).Item(1)
Next

cmbMain.DataSource = New BindingSource(choices, Nothing)
cmbMain.DisplayMember = "Value"
cmbMain.ValueMember = "Key"

Comments

Popular posts from this blog

Arabic to Roman Numerals in JAVA

[SOLVED] Could not reliably determine the server's fully qualified domain name, using * for ServerName