3

I would expect this would be a common need. Can anyone help or point me to a page that explains how to do this?

JohnnyM
  • 28,758
  • 10
  • 38
  • 37

2 Answers2

2

If you mean like the auto-complete options on TextBox, I'm not aware of any in-built support for this. The closest (although not the same) would be to use a DataGridViewComboBoxColumn.

For things not directly available; it looks like other people have looked at this - you might try the sample here.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
0

If you mean that getting data of dataGridView from database with textbox button textChanged event do this.

private void textBox1_TextChanged(object sender, EventArgs e)
{
string query = "select Emp_ID,Emp_Name,Father_Name,Email from Employee where Emp_Name like '" + textBox1.Text + "%' ORDER BY Emp_Name ASC";
using (SqlCommand comand = new SqlCommand(query, con))
{
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = comand;
DataTable ds = new DataTable();
ds.Locale = System.Globalization.CultureInfo.InvariantCulture;
da.Fill(ds);
dataGridView1.DataSource = ds;
}
} 
Wajahat
  • 1
  • 6