Warcraft system, the call of different worlds
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 WindowsFormsApplication1 {public partial class FrmLogin: Form {public FrmLogin () {InitializeComponent ();} public LoginInfo [] array; // used to store Login User Information // 110 array defined as 10 // public LoginInfo [] Persons = new LoginInfo [10]; private void button#click (object sender, EventArgs e) {if (textBox1.Text. trim () = "" | textBox2.Text. trim () = "") {MessageBox. show ("email address or password cannot be blank! "," Prompt ");} else {string userName = textBox1.Text; string pwd = textBox2.Text; bool isOK = false; foreach (LoginInfo item in array) {if (item! = Null) {if (item. email = userName & item. password = pwd) {// lblValidation. visible = false; isOK = true; FrmMain fm = new FrmMain (); // fm. lblName. text = "Welcome," + item. name; // pass the information to the home page fm. show (); break ;}}if (isOK = false) {// lblValidation. visible = true; textBox2.Text = ""; textBox2.Focus () ;}} private void FrmLogin_Load (object sender, EventArgs e) {// The initial three user information: array = new LoginInfo [10]; LoginInfo info1 = new LoginInfo (); info1.Name = "Sun Lili"; info1.Id = "120185198005088521 "; info1.Email = "lili@sohu.com"; info1.Password = "lili1980"; array [0] = info1; LoginInfo info2 = new LoginInfo (); info2.Name = "fan Jingjing"; info2.Id = "110186198111088725 "; info2.Email = "jingjing@sina.com"; info2.Password = "jingjing"; array [1] = info2; LoginInfo info3 = new LoginInfo (); info3.Name = "Chen xiaokun"; info3.Id = "110125197905123571 "; info3.Email = "xiaokun@sohu.com"; info3.Password = "chenkun"; array [2] = info3; // lblValidation. visible = false; // The verification prompt information is hidden at the beginning} private void label4_Click (object sender, EventArgs e) {FrmRegist fr = new FrmRegist (); fr. fl = this; fr. show (); this. hide (); // login form hiding} private void label3_Click (object sender, EventArgs e ){}}}
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 WindowsFormsApplication1 {public partial class FrmRegist: Form {public FrmRegist () {InitializeComponent ();} public FrmLogin fl; // log on to the Form object private void labelease click (object sender, Event Args e) {} private void textBox1_TextChanged (object sender, EventArgs e) {} private void textBox2_TextChanged (object sender, EventArgs e) {} private void button#click (object sender, EventArgs e) {if (txtName. text. trim () = "" | txtId. text. trim () = "" | txtName. text. trim () = "" | txtReEmail. text. trim () = "" | txtId. text. trim () = "" | txtRePwd. text. trim () = "") {return;} bool isOK = True; LoginInfo info = new LoginInfo (); info. name = txtName. text; info. id = txtId. text; if (txtName. text = txtReEmail. text) {info. email = txtName. text;} else {isOK = false;} if (txtId. text = txtRePwd. text) {info. password = txtId. text; isOK = true;} else {isOK = false; // lblEqualPwd. visible = true;} if (isOK) {MessageBox. show ("congratulations, verification passed! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. information); // locate the idle position in the array and pass the registered object to for (int I = 0; I <fl. array. length; I ++) {if (fl. array [I] = null) {fl. array [I] = info; break;} fl. visible = true; this. close () ;}} private void FrmRegist_Load (object sender, EventArgs e) {} private void button2_Click (object sender, EventArgs e) {} private void picturebox#click (object sender, EventArgs e) {}}}