public override void button3_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameErrorLbl.Visible = true; } else { nameErrorLbl.Visible = false; } if (usernametxt.Text == "") { UserNameLbl.Visible = true; } else { nameErrorLbl.Visible = false; } if (usernametxt.Text == "") { UserNameLbl.Visible = true; } else { UserNameLbl.Visible = false; } if (pwdTxt.Text == "") { PwdLbl.Visible = true; } else { PwdLbl.Visible = false; } if (phoneTxt.Text == "") { phoneLbl.Visible = true; } else { phoneLbl.Visible = false; } if (EmailTxt.Text == "") { EmailLbl.Visible = true; } else { EmailLbl.Visible = false; } if (statusDD.SelectedIndex == -1) { statusErrorLbl.Visible = true; } else { statusErrorLbl.Visible = false; } if (nameErrorLbl.Visible || UserNameLbl.Visible || PwdLbl.Visible || phoneLbl.Visible || EmailLbl.Visible || statusErrorLbl.Visible) { MainClass.showMG("Filds With * Are Mandatory", "Stop", "Error"); // Error is the type of Message } else { if (statusDD.SelectedIndex == 0) { stat = 1; } else if (statusDD.SelectedIndex == 1) { stat = 0; } if (edit == 0)//code for save operation { insertion i = new insertion(); i.insertUser(nameTxt.Text, usernametxt.Text, pwdTxt.Text, EmailTxt.Text, phoneTxt.Text, stat); r.Showusers(dataGridView1, userIDGV, NameGV, UserNameGV, PassGV, EmailGV, PhoneGV, statusGV); MainClass.disable_reset(lftPanel); } else if (edit == 1)///for Updte Operation { DialogResult dr = MessageBox.Show("Are you sure, you want to updata Record", "Question..", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { updation u = new updation(); if (statusDD.SelectedIndex == 0) { stat = 1; } else if (statusDD.SelectedIndex == 1) { stat = 0; } u.updateUser(userID, nameTxt.Text, usernametxt.Text, pwdTxt.Text, EmailTxt.Text, phoneTxt.Text, stat); r.Showusers(dataGridView1, userIDGV, NameGV, UserNameGV, PassGV, EmailGV, PhoneGV, statusGV); MainClass.disable_reset(lftPanel); } } } }