private void TimerClosing_Tick(object sender, EventArgs e) { Form_Main fm = new Form_Main(this); this.Opacity -= 0.05; if (this.Opacity == 0) { TimerClosing.Stop(); Timer2.Stop(); Timer1.Stop(); flag = false; this.Visible = false; fm.Show(); fm.WindowState = FormWindowState.Maximized; } }
private void cmdLogin_Click(object sender, EventArgs e) { if (txtUserName.Text == "") { MessageBox.Show("Please enter your Username"); txtUserName.Focus(); return; } // Yêu cầu người sử dụng nhập lại pass if (txtPassword.Text == "") { MessageBox.Show("Please enter your pass"); txtPassword.Focus(); return; } // Gọi hàm kiểm tra username và pass int x = Logged(txtUserName.Text, txtPassword.Text); if (x == -1) { MessageBox.Show("Bạn nhập sai password"); txtPassword.Text = ""; txtPassword.Focus(); } else if (x == -2) { MessageBox.Show("username không tồn tại"); txtUserName.Text = ""; txtUserName.Focus(); } else { flag = true; } if (flag) { TimerClosing.Start(); TimerClosing.Interval = 100; } }