Warcraft Login System

Source: Internet
Author: User

Recording system

Warcraft Login System

1: Create three forms: frmlogin,frmmain,frmregist (Omit step ...)

2: Create an array of objects with a length of 10

Public userinfo[] user = new USERINFO[10];

3: Initialize the array and assign values .

public void Fanfa ()

{

initializing an array

User[0] = new UserInfo ();

User[0].id = 1;

User[0].mail = "1";

User[0].pwd = "1";

}

4: Verify that the mailbox and password are correct in the click time of the login button, and use the value in the text box to iterate through the array to see if there is a value that matches it.

foreach (UserInfo item in user)

{

if (item! = NULL)

{

if (Item.mail = = Mail && item.pwd = = password)

{

Flag = true;

}

}

}

5: If the data matches , implement the jump of the form .

6: Pass the text information of the entered mailbox to the frmmain form . Create a static variable in the Frmmain form , Assign the input text to a static variable in the Frmmain form in the Frmlogin. The label control is displayed .

form2.str = mail;

public static string str;

private void Form2_load (object sender, EventArgs e)

{

Label1. Text = " welcome " +STR;

}

7: Complete the registration function, implement the form jump, create a variable in frmregist,

The Frmlogin Form object is assigned to this variable in the Register button time in Frmlogin, which allows the form to jump after the registration is complete

Frmregist in :p ublic Form1 login;

Frmlogin : Form3 frm = new Form3 ();

Frm.login = this;

8: Implement the Registration function, create an object of the UserInfo class, assign the property of the class, and bind the object in the array, find an empty location to hold the data to be registered

UserInfo user = new UserInfo ();

User.ID = Convert.ToInt32 (TextBox1.Text);

User.mail = TextBox2.Text;

User.pwd = TextBox3.Text;

for (int i = 0; i<login.user.length; i++)

{

if (login.user[i] = = null)

{

Login.user[i] = user;

}

}

Warcraft Login System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.