I am encountering an issue. I have a datagrid and it is loading from my database. I also implemented a textBox which would filter results from the datagrid but for some reason I am getting a NullReferenceException. Below is my code for this particular textBox:
private void textBox2_TextChanged_1(object sender, EventArgs e)
{
(dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("Item_Number LIKE '%{0}%'", textBox2.Text);
}
Where am I going wrong?
I know what a NullReferenceException is I just do not see why I am getting it. This is not a duplicate of an existing NullreferenceException