Posted 8 October 2019, 3:06 pm EST - Updated 4 October 2022, 12:42 am EST
Hi,
I finally found the C# C1ComboBox Sample for creating a MultiColumn ComboBox
In the sample the HTML Pattern uses a class to which it references the names of the used field. Since I got an error when diretcly using a Datatable (for ItemsDataSource) I chanfed my code to also using a class. I however still get the same error. (attached jpg)
I uses this code for setting the ComboBox
Private Sub ErstelleBindingSourceFürWarengruppe()
Dim WGrpen As New List(Of WGrp)
Cmd.CommandText = "Select WGr, Stc, Bez From [Warengruppe] Order by WGr, Stc"
DbRd = Cmd.ExecuteReader()
Try
Do While DbRd.Read()
Dim x As New WGrp
x.WGrpId = DbRd("WGr")
x.Stc = DbRd("Stc")
x.Bez = DbRd("Bez")
WGrpen.Add(x)
Loop
Catch ex As Exception
End Try
Call DbRd.Close()
Me.ccmbSWGrp.ItemsDataSource = WGrpen
Me.ccmbSWGrp.ItemMode = C1.Win.C1Input.ComboItemMode.HtmlPattern
Me.ccmbSWGrp.HtmlPattern = "<table><tr><td width=80 align=right>{WgrpId}</td><td width=100>{Bez}</td></tr><table>"
Me.ccmbSWGrp.ItemsValueMember = "WGrpId"
Me.ccmbSWGrp.ItemsDisplayMember = "WGrpId"
End Sub
And use this class defined within the form.
Private Class WGrp
Public WGrpId As Integer
Public Stc As Integer
Public Bez As String
End Class