First off, Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
Then it's pretty simple:
private void cmdsearch_Click(object sender, EventArgs e)
{
switch (comboBox1.Text.ToLower())
{
case "name":
case "id":
case "contactno":
case "post":
SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM test1 WHERE " + comboBox1.Text + "=@PAR", conn);
adp.SelectCommand.Parameters.AddWithValue("@PAR", textBox3.Text);
DataTable tbl = new DataTable();
adp.Fill(tbl);
dataGridView1.DataSource = tbl;
break;
}
}