Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
Form2 Populates on ButtonClik
qing ryder
Oct 21 2017 9:21 AM
171
Reply
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)
{
// Validating cell value
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();
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Biometric Data Capture and Verification
Tableau in c#.net