private void txtSearch_TextChanged(object sender, EventArgs e) { BindingSource bs = new BindingSource(); bs.DataSource = dataGrid1.DataSource; bs.Filter = "BARCODE like '%" + txtSearch.Text + "%'"; dataGrid1.DataSource = bs; }
000012345
12345
BindingSource bs = new BindingSource(); bs.DataSource = dataGrid1.DataSource; bs.Filter = "BARCODE like '%" + txtSearch.Text + "%'"; dataGrid1.DataSource = bs;
Quote:I have a textbox for make searchs in a specific column, but now i have to modify This code to add always 0000 at the start of the search for example: I need that, If i wrote 00001234 in the textbox it would find 1234 on that column. All the numbers on my column has 4 digits, but the bar code i use to find has 8 digits becouse of that , in the search i need to add four ceros.
BindingSource bs = new BindingSource(); bs.DataSource = dataGrid1.DataSource; string keyword = "0000" + txtSearch.Text.Trim(); bs.Filter = "BARCODE like '%" + keyword + "%'"; dataGrid1.DataSource = bs;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)