I created an unbound MultiColumnComboBox and added the multi-select functionality from the how-to documentation. This works fine, but I'd now like to add some rows and set them as selected when the form loads up based on some text input. So I have gone with the below:
Imports Telerik.WinControls.UI
Public Class Form1
Private Extender As New RadMultiColumnComboBoxSelectionExtender
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
InitCombo()
Extender = New RadMultiColumnComboBoxSelectionExtender()
Extender.AssociatedRadMultiColumnComboBox = combo1
AddExtraItems()
End Sub
Private Sub InitCombo()
combo1.MultiColumnComboBoxElement.Columns.Add("CaseCode")
combo1.MultiColumnComboBoxElement.Columns.Add("Title")
combo1.DisplayMember = "CaseCode"
combo1.ValueMember = "CaseCode"
combo1.EditorControl.Rows.Add("P1234", "Test Case 1")
combo1.EditorControl.Rows.Add("A1234", "Test Case 2")
End Sub
Private Sub AddExtraItems()
AddRow("T12345", "Test Case 3", True)
AddRow("P23445", "Test Case 4", True)
End Sub
Private Sub AddRow(ByVal CaseCodeString As String, ByVal Title As String, Optional ByVal Pinned As Boolean = False)
Dim row = combo1.EditorControl.Rows.NewRow()
row.Cells(0).Value = CaseCodeString
row.Cells(1).Value = Title
If Pinned Then
row.PinPosition = PinnedRowPosition.Top
row.IsSelected = True
row.Tag = True
End If
combo1.EditorControl.Rows.Add(row)
End Sub
Private Sub combo1_DropDownClosing(sender As Object, args As RadPopupClosingEventArgs) Handles combo1.DropDownClosing
args.Cancel = True
End Sub
End Class
This adds items to the list and has them ticked however items do not appear as tokens in the Combobox and if I open the combobox and tick/untick an item the application crashes and the form closes. Is there a specific way to do this? I have attached a small example project to demo what is happening.
Thanks in advance for any help!