private void CommonForm_FormClosed(object sender, FormClosedEventArgs e) { FormCollection fc = Application.OpenForms; foreach (Form f in fc) { if (f.Name == "LoginForm") { Userdata.getUser().UserID = string.Empty; Userdata.getUser().Username = string.Empty; Userdata.getUser().Location = string.Empty; f.Show(); } } }
private void btnOK_Click(object sender, EventArgs e) { pass = sql.sqlExecuteScalarString("select password from user_tbl where userid ='" + id + "' and password='******'"); if (!string.IsNullOrEmpty(pass)) { txtPassword.Text = string.Empty; name = sql.sqlExecuteScalarString("select username from user_tbl where userid='" + id + "'"); locate = sql.sqlExecuteScalarString("select location from user_tbl where userid='" + id + "'"); Userdata.getUser().Username = name; Userdata.getUser().Location = locate; MainForm main = new MainForm(); this.Hide(); main.ShowDialog(); } else { MessageBox.Show("Wrong password!!!"); } }
private void CommonForm_Load(object sender, EventArgs e) { this.lbUsername.Text = Userdata.getUser().Username; this.lbLocation.Text = Userdata.getUser().Location; }