protected override void btnsave_Click(object sender, EventArgs e) { //Check if textbox null or empty if (string.IsNullOrEmpty(txtUsrname.Text) || string.IsNullOrEmpty(txtPass.Text) || string.IsNullOrEmpty(txtConPass.Text)) { MessageBox.Show("Username and Password are Mandatory." + Environment.NewLine + "Please try again.", "Incorrect Input", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //check if pass and con pass match if (string.Compare(txtConPass.Text, txtPass.Text) != 0) { MessageBox.Show("Password and Confirm Password do not match." + Environment.NewLine + "Please try again.", "Incorrect Input", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPass.Text = string.Empty; txtUsrname.Focus(); txtUsrname.Text = string.Empty; txtConPass.Text = string.Empty; return; } //save user into DB qry = "insert userprivilege(USPUSERNAME,USPPASSWORD,USPCREATEDBY,USPCREATEDON)values('" + txtUsrname.Text + "','" + txtPass.Text + "','" + User.UserId + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "')"; objData.executeQry(qry); //save userAttribute into DB if (modify != true) { for (int i = this.chklstbx.Items.Count - 1; i >= 0; i--) { qry = "insert into userattribute(UAuserid,UAmenu,UAenable,UACREATEDBY,UACREATEDON,UAMODIFIEDBY,UAMODIFIEDon)values('" + User.UserId + "','" + ++i + "','" + this.chklstbx.GetItemCheckState(i) + "'," + com.qrytime("ins") + ")"; objData.executeQry(qry); //status bar value inserted } } else { //for updates for (int i = this.chklstbx.Items.Count - 1; i >= 0; i--) { qry = "update userattribute set UAenable='" + this.chklstbx.GetItemCheckState(i) + "'," + com.qrytime("upd", "UA") + " where UAuserid='" + User.UserId + "' and UAmenu='" + ++i + "'"; objData.executeQry(qry); //Status Bar values are updated. } } //Accessing the Status bar in Winform Abstract (Parent) ((WinformAbstract)this.ParentForm).updateStatus("Values Saved"); //Clear all Controls After Save com.clearcontrol(GrbxNewUser, false); LOADCHECKBX("reset"); txtUsrname.Focus(); }