hi its me again,
i have this scenario where i need to search my datagridview using the textbox i have, i have tried copying other sites but what it gives me is errors, new columns and more errors,
my codes goes like this for loading my datas from the database to the gridview

private void cashier_update_Load(object sender, EventArgs e){   
con.ConnectionString = @"";
            SqlDataAdapter sda = new SqlDataAdapter("SELECT entry_no,prod_id, prod_name, wantiti,item_status FROM Table_3 Where item_status= 'ACTIVE'", con); 
            DataTable dt = new DataTable();
            foreach (DataRow item in dt.Rows)
                int n = dataGridViewX1.Rows.Add();
                dataGridViewX1.Rows[n].Cells[0].Value = item[0].ToString();
                dataGridViewX1.Rows[n].Cells[1].Value = item[1].ToString();
                dataGridViewX1.Rows[n].Cells[2].Value = item[2].ToString();
                dataGridViewX1.Rows[n].Cells[3].Value = item[3].ToString();
        }   }

now what i need is to search the column 2 which is prod_name via key_up or textchange. thank you for the help .
more power

foreach (DataGridViewRow row in dataGridViewX1.Rows)
                 if (row.Cells[1].Value.ToString().Equals(MyTextBoxText))
                     //do whatever

Something like this perhaps?

commented: What I'd have done. +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.