i have two forms.
on form1 is a datagridview and button.
On ButtonClick event, the datagridview is being validated and if null or empty, it returns back else form2 should open. (that is the syntax)
but when the application runs, and form2 is to be open, it populates about 15 of form2.
please how do i stop the population
here is the code
- private void button3_Click(object sender, EventArgs e)
- {
- this.dataGridView1.ClearSelection();
- foreach (DataGridViewRow row in dataGridView1.Rows)
- {
- if (row.IsNewRow) { return; }
- foreach (DataGridViewCell cell in row.Cells)
- {
-
- var regexItem = new System.Text.RegularExpressions.Regex("^[a-zA-Z0-9 ]$");
- if (cell.Value == null || !regexItem.IsMatch(cell.Value.ToString()))
- {
- cell.Style.BackColor = Color.Red;
- }
-
- }
- }
- this.Hide();
- resultVV f2 = new resultVV();
- f2.Show();
- }