How to get the selected values in the WinForms MultiSelectionComboBox?
Show the selected item in ListBox
You can get the selected values in the WinForms MultiSelectionComboBox by using the SelectedItems or the VisualItems property.
C#
//Gets the Visual items in the MultiSelectionComboBox. foreach (VisualItem obj in this.multiSelectionComboBox1.VisualItems) { //Adds the selected item in the ListBox. listBox1.Items.Add(obj.Text); } //Gets the selected items in the MultiSelectionComboBox. foreach (object obj in this.multiSelectionComboBox1.SelectedItems) { //Adds the selected item in the ListBox. listBox1.Items.Add(obj.ToString()); }
VB
'Gets the Visual items in the MultiSelectionComboBox. For Each obj As VisualItem In Me.multiSelectionComboBox1.VisualItems Microsoft.VisualBasic.ChrW(84) listBox1.Items.Add(obj.Text) Next 'Gets the selected items in the MultiSelectionComboBox. For Each obj As Object In Me.multiSelectionComboBox1.SelectedItems 'Adds the selected item in the ListBox. listBox1.Items.Add(obj.ToString()) Next obj
Figure 1: Selected item displayed in ListBox
Samples:
C#: MultiSelectionComboBox_SelectedValue_C#
VB: MultiSelectionComboBox_SelectedValue_VB
Conclusion
I hope you enjoyed learning about How to get the selected values in the WinForms MultiSelectionComboBox?
You can refer to our WinForms MultiSelectionComboBox feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!