Search datagrid after Combobox selection index changed c#

  • 273 Views
  • Last Post 24 December 2018
Stylus STYLUS posted this 20 December 2018

Search datagrid after Combobox selection index changed in c#

Some help?

admin posted this 24 December 2018

You can add a bindingsource to your DataGridView, then using the Filter property to filter your data in DataGridView

For example

bindingsource.Filter = $"CategoryID = '{cboCategory.SelectValue}'";

You can also combine filter with the textbox control

bindingsource.Filter = $"CategoryID = '{cboCategory.SelectValue}' and ProductName like '*{txtSearch.Text}*'";
Close