Hi Guys, I hope you can help me out...
I have a slight issue in where the 'Search Box' Code I currently have seems to sift through the Populated Data Grid View fine. However, when selecting an Account that has been filtered by the use off the 'Search Box' it correctly populates the TextBoxes but when clearing the 'Search Box' it then removes the data in the Grid view below which I don't want.
My question is, How do I stop this from happening? I want to keep the DGV Populated to re-use again. I have attached screenshots of the program.
Capture1.jpg - Shows the Populated DGV with a Customer Search Box above.
Capture2.jpg - Filtering the list to show the perferred account.
Capture3.jpg - Clicking on the Filtered Account which in turn populates the Text Boxes on the left.
Capture4.jpg - When 'Backspacing the data in the search box' the DGV below is empty?
Below is the Code Block Currently Being used (Beginner here writing code...)
private void textBox2_TextChanged(object sender, EventArgs e)
{
//Below Searches on the Cash Accounts DataSet for Matching Accounts.
if (radioButton1.Checked == true)
{
DataView DV = new DataView();
DV.Table = ds.Tables["cashCustomers"];
DV.RowFilter = "CashAccRef LIKE '%" + textBox2.Text + "%' OR CashName LIKE '%" + textBox2.Text + "%' ";
dataGridView1.DataSource = DV;
}
}
Hope you guys can help and this is driving me nuts!
Thanks in advance! I've learnt a lot from DaniWeb.