public loginForm() { var connectionString = ConfigurationManager.ConnectionStrings["TravelScheduleDB"].ConnectionString; InitializeComponent(); connectionObj = new SqlConnection(@connectionString); menuForm MenuObj = new menuForm(); textBox1.PasswordChar = '*'; ObjLogin = new controllerlogin(); LoadUsernames(); comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; }
private void Button1_Click(object sender, EventArgs e) // Login Button { menuForm MenuObj = new menuForm(); try { loginModel LoginObj = new loginModel(comboBox1.SelectedValue.ToString(), textBox1.Text); ObjLogin.validateLogin(LoginObj); textBox1.Text = ""; this.Visible = false; DialogResult dr = MenuObj.ShowDialog(this); this.Visible = true; } catch (LoginFailureException s) { MessageBox.Show(s.Message); } }