private void registerMenu_FormClosed(object sender, FormClosedEventArgs e) { this.Hide(); menuForm menuForm = new menuForm(username); menuForm.Show(); }
private void showForm_FormClosed(object sender, FormClosedEventArgs e) { this.Hide(); menuForm form = new menuForm(username); form.Show(); }
private void login() { // Extract data from TextBox string username = alphaBlendTextBox4.Text; string password = alphaBlendTextBox5.Text; // Validation of data if (username == "" || password == "") { MessageBox.Show("Nu puteți lăsa câmpuri goale!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Database connection SqlConnection sqlcon = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\School\Anul III\Practica Anul III\bookstore-application\Bookstore.mdf;Integrated Security=True"); // Login System string query = "SELECT * FROM Users WHERE Username = '******'AND Password = '******'"; SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { this.Hide(); menuForm f5 = new menuForm(username); f5.Show(); } else { MessageBox.Show("Datele introduse sunt incorecte!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void tabControl1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Hide(); menuForm menuForm = new menuForm(null); menuForm.Show(); } }