private void btnClose_Click(object sender, EventArgs e) { if (tbStudentNumber.Text.Length == 0) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_StudVio.Text; mainForm.Show(); this.Close(); }//if else { DialogResult dialog = MessageBox.Show("There are unsaved data in the form. Close this form?", "Close Student Violations Form", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialog == DialogResult.OK) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_StudVio.Text; mainForm.Show(); this.Close(); } else { //Do Nothing } }//else }
private void btnClose_Click(object sender, EventArgs e) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_VioMemo.Text; mainForm.Show(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { //SqlConnection con = new SqlConnection(conect); //con.Open(); if (tbUsername.Text == "admin" && tbPassword.Text == "admin123") { MessageBox.Show("Welcome!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); MainForm mnFrm = new MainForm(); mnFrm.strPassedUserID = tbUsername.Text; mnFrm.Show(); } else { SqlConnection con = new SqlConnection(conect); con.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT COUNT(*) FROM USERACCOUNTS WHERE Account_ID = '" + tbUsername.Text + "' AND Password = '******'", con); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { MessageBox.Show("Welcome!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); MainForm mnFrm = new MainForm(); mnFrm.strPassedUserID = tbUsername.Text; mnFrm.Show(); } else { MessageBox.Show("Invalid login credentials. Please try again.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information); tbUsername.Clear(); tbPassword.Clear(); } } }
private void button1_Click(object sender, EventArgs e) { if (tbViolationInfoID.Text.Length == 0 && tbViolationName.Text.Length == 0 && tbSanction.Text.Length == 0) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_ViolationInfo.Text; mainForm.Show(); this.Close(); }//if else { DialogResult dialog = MessageBox.Show("There are unsaved data in the form. Close this form?", "Close Violation Information Form", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialog == DialogResult.OK) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_ViolationInfo.Text; mainForm.Show(); this.Close(); } else { } }//else }
private void button1_Click(object sender, EventArgs e) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_CardActive.Text; mainForm.Show(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (tbCourseID.Text.Length == 0 && tbCourseName.Text.Length == 0 && tbAbbreviation.Text.Length == 0) { MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_Courses.Text; mainForm.Show(); this.Close(); }//if else { DialogResult dialog = MessageBox.Show("There are unsaved data in the form. Close this form?", "Close Course Form", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialog == DialogResult.OK) { this.Close(); MainForm mainForm = new MainForm(); mainForm.strPassedUserID = lblUserID_Courses.Text; mainForm.Show(); } else { //do nothing } }//else }