else {
if (ErrorNum == cl.LName) {
Num += 1; if (Num >= 3) {
this.Close(); } } else {
ErrorNum = cl.LName; Num += 1; }
MessageBox.Show(\密码有误,三次后将自动关闭,这是第\次\
this.txtPwd.Text = string.Empty; this.txtPwd.Focus();
}
#endregion }
private void txtPwd_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == 13) this.btnLogin.Focus();
}
private void btnCancel_Click(object sender, EventArgs e) {
Application.Exit(); //Environment.Exit(0); }
#region//clerarTextBox private void clearText() {
foreach (Control cont in this.gbLogin.Controls) { if
(cont.GetType().ToString()
\
{
cont.Text = string.Empty;
} } }
#endregion
private void frmUserLogin_Load(object sender, EventArgs e) {
con.ConDatabase(); { try
==
{
SqlDataAdapter da = new SqlDataAdapter(\* from tb_login\
DataTable dt = new DataTable(); da.Fill(dt);
this.cobName.DataSource = dt.DefaultView; cobName.DisplayMember = \ }
catch (Exception ey) {
MessageBox.Show(ey.Message); } } } } }
7.2.4用户信息存储程序代码
using System;
using System.Collections.Generic; using System.Text;
namespace houseAgency.mothedCls {
class clsUser {
private string User_IDS; private string User_names; private string User_sex; private string User_birth;
private string User_phone; private string User_homePhone; private string User_email; private string User_cardID; private string User_type; private string house_ID=\ private string User_recordDate;
public string id {
get { return User_IDS; } set { User_IDS = value; } }
public string name {
get { return User_names; } set { User_names = value; } }
public string sex {
get { return User_sex; } set { User_sex = value; } }
public string birth {
get { return User_birth; }
set { User_birth = value; } }
public string phone {
get { return User_phone; } set { User_phone = value; } }
public string homePhone {
get { return User_homePhone; } set { User_homePhone = value; } }
public string email {
get { return User_email; } set { User_email = value; } }
public string cardID {
get { return User_cardID; } set { User_cardID = value; } }
public string type