Nào thì cũng đua đòi voọc Visual Studio... Mình có tạo Form đăng nhập này mà không hiểu sao lỗi thế nào mà nó không chạy được chứ!!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace VietDutch.QLSN
{
public partial class Form1 : Form
{
static int count = 0;
public Form1()
{
InitializeComponent();
}
private void bt_Thoat_Click(object sender, EventArgs e)
{
Application.ExitThread();
}
private void bt_DangNhap_Click(object sender, EventArgs e)
{
account ac = new account("RanjuDang","123");
if (txtTenDangNhap.text.trim().Equals(ac.Username)&& txtMatKhau.Text.Trim().Equals(ac.Password)
{
MessageBox.Show("Bạn đã đăng nhập thành công!");
}
else
{
MessageBox.Show("Tên đăng nhập hoặc mật khẩu chưa đúng. Hãy kiểm tra lại nhé!");
count = count + 1;
if (count>=3)
{
txtTenDangNhap.Enabled = false;
MessageBox.Show("Không được nhập sai quá 3 lần!");
}
class account
{
private string _Username;
public string Username
{
get { return _Username; }
set { _Username = value; }
private string _Password;
public string Password
{
get { return _Password; }
set { _Password = value; }
}
public account(string Username, string Password)
{
this.Username = Username;
this.Password = Password;
}
Mọi người xem và góp ý thêm cho mình nhé!
https://facebook.com/569100319856001_961732393926123