Note that there are some explanatory texts on larger screens.

plurals
  1. POFilter while typing
    primarykey
    data
    text
    <p>In my winforms app I have a textbox which filters the datagrid while typing (search while typing), this works fine, I also have another button to apply a filter via two comboboxes.</p> <p>This button does a copy of the datatable connected to the datagridview as datasource, and changes the datagridviews datasource to the copy of the datatable.</p> <p>When this filter is applied via the button, I make another button visible (called btnRemoveFilterFserie) to "remove" the filter by changing the datasource back to the original datatable.</p> <p>When btnRemoveFilterFserie.Visible == true it means that a other filter is applied and I want to apply the search when typing on the DS1Filter3 datatable, but it returns an error that the [Description] column isn't found on this line</p> <pre><code>DataRow[] result = DS1Filter.Select(outputInfo); </code></pre> <p>I hope it isn't to confusing to understand my explanation.</p> <p>This is the code that I use.</p> <pre><code>private void txtFserieSearch_KeyUp(object sender, KeyEventArgs e) { string outputInfo = ""; string[] keyWords = txtFserieSearch.Text.Split(' '); foreach (string word in keyWords) { if (outputInfo.Length == 0) { outputInfo = "(Description LIKE '%" + word + "%' OR `Function Value` LIKE '%" + word + "%')"; } else { outputInfo += " AND (Description LIKE '%" + word + "%' OR `Function Value` LIKE '%" + word + "%')"; } } if (btnRemoveFilterFserie.Visible == true) { //Applies the filter to the DataView DataRow[] result = DS1Filter.Select(outputInfo); DataTable DS1Filter3 = DS1Filter.Clone(); foreach (DataRow row in result) { DS1Filter3.ImportRow(row); } dataGridFserie.DataSource = DS1Filter3; } else if (btnRemoveFilterFserie.Visible == false) { DataRow[] result = DS1.Select(outputInfo); DataTable DS1Filter2 = DS1.Clone(); foreach (DataRow row in result) { DS1Filter2.ImportRow(row); } dataGridFserie.DataSource = DS1Filter2; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload