Sql query to search from MultiSelection SfComboBox

Hello,

I have a  SfComboBox that have multiselection option.

Now i need to make search in my database depends on the selected items in the combobox.

I did that query but it seems not working:

"select * from BuyInvoices where InvoiceNum like N'%" & (sfComboBox1.Text) & "%" & "'" & " and Status = 'True' order by InvoiceNum"

I've tried also:

sfComboBox1.SelectedItem
sfComboBox1.SelectedValue
sfComboBox1.SelectedIndex

4 Replies

MS Mahalakshmi Sugumar Syncfusion Team April 28, 2022 10:02 AM UTC

Hi Mohamed Maghrabi,


In SfComboBox Multiselection, the highlighted item is stored in the SelectedItems collection, while the items we checked are saved in the CheckedItems collection.

To get all the selected items in multiple selection, please use CheckedItems property.


Please refer to the documentation for further details

URL: https://help.syncfusion.com/windowsforms/combobox/selection#accessing-the-checked-items


SelectedItem, SelectedValue and SelectedIndex properties are used for single selection.

URL : https://help.syncfusion.com/windowsforms/combobox/selection#getting-the-selected-index


Regards,
Mahalakshmi Sugumar



MM Mohamed Maghrabi April 28, 2022 11:50 AM UTC

Thanks for your reply

But can you give me an example code in VB.NET to call the checkeditems from SfComboBox

Thank you 



MS Mahalakshmi Sugumar Syncfusion Team replied to Mohamed Maghrabi April 29, 2022 05:58 PM UTC

Hi Mohamad,


 We are validating your request. We will update your requirement within two days. We appreciate your patience until then.

 

Regards,

Mahalakashmi Sugumar



MS Mahalakshmi Sugumar Syncfusion Team May 2, 2022 05:01 PM UTC

Hi Mohamad,

Please refer to the below code for Checked Items collection event, you can get the selected items in Checked Items property.


Code:

   
sfComboBox1.CheckedItems.CollectionChanged += CheckedItems_CollectionChanged


 Private Sub CheckedItems_CollectionChanged(ByVal sender As Object, ByVal e As          System.Collections.Specialized.NotifyCollectionChangedEventArgs)

  foreach(Object item in sfComboBox1.CheckedItems)

      {

      }
   End Sub

Please refer to the documentation link below for further details


Link: https://help.syncfusion.com/cr/windowsforms/Syncfusion.WinForms.ListView.SfComboBox.html#Syncfusion_WinForms_ListView_SfComboBox_CheckedItems


Regards,
Mahalakshmi Sugumar


Loader.
Up arrow icon