public override void button3_Click(object sender, EventArgs e) { if (CategoryTxt.Text == "") { CategoryErrorLbl.Visible = true; } else { CategoryErrorLbl.Visible = false; } if (activeDD.SelectedIndex == -1) { ActiveErrorlbl.Visible = true; } else { ActiveErrorlbl.Visible = false; } if (ActiveErrorlbl.Visible || CategoryErrorLbl.Visible) { MainClass.showMG("Filds With * Are Mandatory", "Stop", "Error"); // Error is the type of Message } else { if (activeDD.SelectedIndex == 0) { stat = 1; } else if (activeDD.SelectedIndex == 1) { stat = 0; } if (edit == 0)//code for save operation { insertion i = new insertion(); i.insertCat(CategoryTxt.Text, stat); r.ShowCategories(dataGridView1, catIDGV, NameGV, 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 (activeDD.SelectedIndex == 0) { stat = 1; } else if (activeDD.SelectedIndex == 1) { stat = 0; } u.updateCat(catID, CategoryTxt.Text, stat); r.ShowCategories(dataGridView1, catIDGV, NameGV, statusGV); MainClass.disable_reset(lftPanel); } } } }