private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text != "") { dataGridView1.DataSource = db.Load_Purchase_Order(). Where(o => o.PO_Number.Contains(textBox1.Text.ToUpper())).ToList(); if (dataGridView1.RowCount == 0) { MessageBox.Show("No results found"); textBox1.Clear(); dataGridView1.DataSource = db.Load_Purchase_Order_1().ToList(); } } dataGridView1.DataSource = db.Load_Purchase_Order_1().ToList(); }