private void button1_Click(object sender, EventArgs e) { //logowanie using (db = new DataClasses1DataContext()) { if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("You did not complete the form!"); } else { var count = (from u in db.users where u.login == textBox1.Text && u.password == textBox2.Text && u.active == true select u).Count(); //MessageBox.Show(count.ToString()); if (count >= 1) { string login = textBox1.Text; Form_main form_main = new Form_main(login); form_main.Show(); Hide(); } else { MessageBox.Show("Wrongly completed form. Please correct errors!"); } } } }
private void button2_Click(object sender, EventArgs e) { Form_main form_main = new Form_main(this.temp); form_main.Show(); this.Hide(); }