public static void ReadDoc() { FileStream file1 = new FileStream(@"user.txt", FileMode.OpenOrCreate); StreamReader Read1 = new StreamReader(file1); UserInfo user = null; while (!Read1.EndOfStream) { user = new UserInfo(); user.Account = Read1.ReadLine(); user.Name = Read1.ReadLine(); user.Pass = Read1.ReadLine(); user.Money = Convert.ToDouble(Read1.ReadLine()); users.Add(user); } Read1.Close(); }
private void Sure_Click(object sender, EventArgs e) { foreach (UserInfo user in Program.users) { if (account.Text == user.Account) { MessageBox.Show("帐号存在,请重新输入"); return; } if (account.Text.Length != 16) { lable1.Text = "帐号必须为16位"; return; } if (account.Text == String.Empty)//|| Convert.ToInt32(account.Text) < 0) { MessageBox.Show("此帐号不能为空,而且不能为负数"); return; } } if (pass1.Text.Length!=6) { label5.Text = "密码长度必须为6位"; return; } if (pass1.Text != pass2.Text) { label6.Text = "两次输入的密码不一致"; return; } else { UserInfo user = new UserInfo(); user.Account = account.Text; user.Name = name.Text; user.Pass = pass1.Text; user.Money = 0; Program.users.Add(user); MessageBox.Show("注册成功!"); } }
public void SetInfo(UserInfo user) { user.Account = Account.Text; user.Pass = Pass.Text; }
private void button_OK_Click(object sender, EventArgs e) { use = ch.m_user; m_Name.Text = ch.m_user.Name; money1.Text = Convert.ToString(ch.m_user.Money); }
public void SetUser(UserInfo user) { m_user = user; }
public Choose() { InitializeComponent(); m_user = new UserInfo(); }