private void btXong_Click(object sender, EventArgs e) { try { string user = txtTen.Text; string pass = txtMatKhau.Text; if (user.Length < 4 || pass.Length < 4 || user.Length > 12 || pass.Length > 12) { throw new OverflowException(); } if (user != "" && pass != "") { if (KiemTraDangNhap(user, pass) == true) { Form f = new FrmGame(); f.Show(); } } else { MessageBox.Show("Phải nhập liệu! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (IndexOutOfRangeException) { MessageBox.Show("Sai tên tài khoản hoặc mật khẩu! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (OverflowException) { MessageBox.Show(" Nhập từ 4 đến 12 kí tự \n\n Tên đăng nhập hoặc mật khẩu có độ dài sai quá định!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmLuuDiem_Load(object sender, EventArgs e) { lbNickName.Text = FrmSignIn.getNickname(); lbDiem.Text = FrmGame.getDiem().ToString(); }