Hi all,
Im working with DataGridView and trying to apply TextBox(keypress) dynamic filter.
Im using DefaultView.RowFilter with proper parameters. Filter works, but there is problem with "updating" table.
Lets have a search word: bicycle
When I type first letter into textbox "b" , nothing happends. When I type second letter "i", filter is set to "b" and shows appropriate results for "b".
Code that handles textchange
Am I missing something? Thank You for any help!Code:// Assignment tbox_search.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dynamicFilter_KeyPress); // Keypress function public void dynamicFilter_KeyPress(Object sender, KeyEventArgs e) { Control ctr = (Control)sender; (dtgview.DataSource as DataTable).DefaultView.RowFilter = string.Format("{0} LIKE '%{1}%'", dtgview.Columns[ctr.TabIndex].Name, ctr.Text); }




Reply With Quote
