private void btn_Save_Click(object sender, EventArgs e) { if (txt_GroupName.Text == "") { MessageBox.Show("Please Fill the Fields"); } else { ProductGroup pg = new ProductGroup(); pg.GroupName = txt_GroupName.Text; int ID = pg.Save(); if (ID <= 0) { MessageBox.Show("Invalid Entry . Please try again"); } else { this.Close(); } } }