If grv_temporary.Rows(i).Cells(6).Text = TextBox1.Text Then msgbox(There has been same data on the list.") Exit For 'do not continue process Else 'add value
boolean found = false; foreach (DataGridViewRow row in grv_temporary) { if (grv_temporary.Rows(i).Cells(6).Value == TextBox1.Text) { // row exists found = true; MessageBox.Show("Row already exists"); break; } } if (!found) { grv_temporary.Rows.Add(TextBox1.Text); // Your values here. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)