|
发表于 2010-3-14 13:46:43
|
显示全部楼层
- namespace Login
- {
- class Users
- {
- string no;
- string pass;
- public Users(string no, string pass)
- {
- this.no = no;
- this.pass = pass;
- }
- public void Login(string no,string pass)
- {
- if (this.no!=no)
- {
- //MessageBox.Show("用户名错误", "警告!");
- return;
- }
- if ( this.pass!=pass )
- {
- // MessageBox.Show("密码错误","警告!");
- return;
- }
- }
- }
- }
复制代码- private void butLogin_Click(object sender, EventArgs e)
- {
- Users us = new Users("feili","123");
- try
- {
- us.Login(this.txtname.Text, this.txtpass.Text);
- }
- catch
- {
- }
- }
复制代码 |
|