I have found a good combobox with multiple fields
The example shows filling the combobox from a listview, but I want to fill
it with zip-code and cities from a database.
The example is as follows:
Dim dtLoading As New DataTable("UsStates")
dtLoading.Columns.Add("Name", System.Type.GetType("System.String"))
dtLoading.Columns.Add("Abbreviation", System.Type.GetType("System.String"))
dtLoading.Columns.Add("Population", System.Type.GetType("System.String"))
dtLoading.Columns.Add("Size", System.Type.GetType("System.String"))
For Each li As ListViewItem In lsvData.Items
Dim dr As DataRow
dr = dtLoading.NewRow
dr("Name") = li.Text
dr("Abbreviation") = li.SubItems(1).Text
dr("Population") = li.SubItems(2).Text
dr("Size") = li.SubItems(3).Text
dtLoading.Rows.Add(dr)
Next
comboTest.SelectedIndex = -1
comboTest.Items.Clear()
comboTest.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
comboTest.SourceDataString = New String(3) {"Name", "Abbreviation",
"Population", "Size"}
comboTest.SourceDataTable = dtLoading
MsgBox("Loading completed!", MsgBoxStyle.Information)
How can I make the source a datatable instead of the listview
regards
reidarT