| List for WinForms Task-Based Help > Hiding Rows Using RowFilter |
To hide a row on a C1List control bound to a DataSource, use a filter on the default view of the DataTable.
For a single filter, add the following code to the Form_Load event to create a filter with the criteria for the rows that you would like to remain visible:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.CustomersBindingSource.Filter = "(CustType='1' OR CustType='3') AND Company LIKE '%Computer%'" |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.CustomersBindingSource.Filter = "(CustType='1' OR CustType='3') AND Company LIKE '%Computer%'"; |
|
The final result will look like this, where only companies with the word computer and CustType equal to 1 or 3 appear:

You can also create multiple filters for a C1List control using a ComboBox to choose which filter you would like to apply. Add the following SelectedIndexChanged event of the ComboBox:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Select Case ComboBox1.SelectedItem
Case "Prospective"
Me.CustomersBindingSource.Filter = "CustType='1' AND Company LIKE '%Computer%'"
Case "Normal"
Me.CustomersBindingSource.Filter = "CustType='2' AND Company LIKE '%Computer%'"
Case "Buyer"
Me.CustomersBindingSource.Filter = "CustType='3' AND Company LIKE '%Computer%'"
Case "Distributor"
Me.CustomersBindingSource.Filter = "CustType='4' AND Company LIKE '%Computer%'"
Case "Other"
Me.CustomersBindingSource.Filter = "CustType='5' AND Company LIKE '%Computer%'"
End Select
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch (comboBox1.SelectedItem)
{
case "Prospective" :
{
this.CustomersBindingSource.Filter = "CustType'1' AND Company LIKE '%Computer%'";
break;
}
case "Normal" :
{
this.CustomersBindingSource.Filter = "CustType'2' AND Company LIKE '%Computer%'";
break;
}
case "Buyer" :
{
this.CustomersBindingSource.Filter = "CustType'3' AND Company LIKE '%Computer%'";
break;
}
case "Distributor" :
{
this.CustomersBindingSource.Filter = "CustType'4' AND Company LIKE '%Computer%'";
break;
}
case "Other" :
{
this.CustomersBindingSource.Filter = "CustType'5' AND Company LIKE '%Computer%'";
break;
}
}
}
|
|
When a customer type is selected from the drop-down list, only companies matching that customer type and containing the word computer will appear.

![]() |
Note: If there are no results that meet the filter requirements, then nothing will appear in the C1List control. |