C# Visual - Datagridview search if textbox = cell string
问题 I am trying to make it so that when you enter data into DataGridView it first checks if the ID textbox contains a string that exists in the DataGridView ID column and throws an error if it finds a match. If it does not match then the system can add the data. I tried all kind of codes that people posted nothing worked. here is my latest. private void btnadd_Click(object sender, EventArgs e) { Label label25 = new Label(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0]