Analysis of the WinForm of Student Information Management System (3) _c# tutorial

Source: Internet
Author: User
Tags exit in

First of all, to supplement the Student Information Management system login form, in the process of completion is always encountered a variety of problems, for the design of the login form or there are some drawbacks, that is, the need to log into the Student information management system if the data entered errors do not have to delete one by one, You need to add a button control that empties the write data on the form and change its property text to reset. There is also a login window designed with a property acceptbutton it to determine the button's unique name (that is, button1), so we can also log on to the Student information management system after the return key to the corresponding CancelButton change it to cancel the button's unique name ( That is button2), so you can exit the login window after you press the exit key.
The code for the Click event that needs to be added to the Reset button button control is:

<span style= "FONT-SIZE:18PX;" >private void Button3_Click (object sender, EventArgs e) 
{ 
 TextBox1.Text = ""; 
 TextBox2.Text = ""; 
} </span> 

The login window after the change is completed:

Here's how to design some of the subforms you need to use.

I. Student information Add form

Student Information Adding form forms is mainly used to add student information or modify student information. Enter the number, name, sex, date of birth, home address, home phone and the class, click the "Save" button can be entered or modify the Student information record, click the "Cancel" button, quit the student information to add the form. The controls that the form needs to use are label controls, TextBox controls, Button controls, panel controls, and ComboBox controls. Student management is found in the menu options in the Student Information Management System home page, and the student information is added by clicking the student information again.

Second, user information add form

User information to add a form is primarily to implement the add operation of the logged-in user. This form contains information such as user name, password, confirmation password, and user rights. When you click the "Save" button, you can add the user's information to the database. Click the "Cancel" button to exit the user information to add the form. The controls that the form needs to use are label controls, TextBox controls, Button controls, panel controls, and ComboBox controls. To find System management in the menu options in the Student Information Management System home page, click the user information again to see the user Information added window.

Third, the user changes the password form

The user modifies the password form mainly realizes the user modifies the password the function. In this form, you can modify the user's login password by entering a username and password, and then entering a new password and confirming a new password. The control that this form needs to use is a Label control, a TextBox control, a button control, and a panel control. In the Student Information Management System home page in the menu options found in the System management, click the user to modify the password again will appear user Modified password added window.

The cancellation buttons in the three subform above are all the same code writes:

<span style= "FONT-SIZE:18PX;" >private void Button2_Click (object sender, EventArgs e) 
{close 
  (); 
} </span> 

The code for the complete FORM1 (Student Information Management System Login window) after the above changes and subform additions are:

 <span style= "FONT-SIZE:18PX;" 
>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 WindowsForms {public partial class Form1:form {public Form1 () {InitializeComponent ( 
    ); } private void Button1_Click (object sender, EventArgs e) {string str = textbox1.text;//gets you input in TextBox1 Information Form2 ad = new Form2 (str);//Create an object ad for the main interface of the Student information management system. Show ()//Click OK to enter student information Management System main interface this. Hide ();//Click to make sure that the login window} private void Button2_Click (object sender, EventArgs e) {application.exit () //Click Cancel to exit the entire program} private void Button3_Click (object sender, EventArgs e) {TextBox1.Text = "";//This is empty You write the user name TextBox2.Text = "";//This is to empty the user password you write}}}</span></span> 

The code for the

Complete FORM2 (Student Information Management System master page) is:

<span style= "FONT-SIZE:18PX;" ><span style= "FONT-SIZE:18PX;" 
>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 WindowsForms {public partial class Form2:form {public Form2 (string s) {Initializeco 
      Mponent (); Tssl_name.  
    Text = s;//The information entered by the login window TextBox1 to the Status bar Text property} private void Exit Toolstripmenuitem_click (object sender, EventArgs e) {application.exit ()//Click Exit in Main Menu we exit the entire program} private void Menustrip1_itemclicked (object sender, Too 
    Lstripitemclickedeventargs e) {} private void Toolstripbutton1_click (object sender, EventArgs e) {Children QQ = new Children ();//Create an instance of a subform qq. MdiParent = this;//requires the subform's parent form to be an MDI form QQ. 
    Show (); private void Student Information Toolstripmenuitem_click (object sender, EvEntargs e) {Children1 C1 = new Children1 (); C1. 
      MdiParent = this; C1. 
    Show (); private void User Information Toolstripmenuitem_click (object sender, EventArgs e) {Children2 C2 = new Children2 () 
      ; C2. 
      MdiParent = this; C2. 
    Show (); private void User Password modified Toolstripmenuitem_click (object sender, EventArgs e) {Children3 C3 = new Children3 
      (); C3. 
      MdiParent = this; C3. 
    Show (); 
 }}}</span>

The code for the Complete subform CHILDREN1 (Student information Add form) is:

<span style= "FONT-SIZE:18PX;" >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 WindowsForms 
{public 
  partial class Children1:form 
  {public 
    Children1 () 
      { InitializeComponent (); 
    } 
 
    private void Button2_Click (object sender, EventArgs e) 
    {close 
      (); 
  } 
}} </span> 

The code for the Complete subform Children2 (user information Add form) is:

<span style= "FONT-SIZE:18PX;" >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 WindowsForms 
{public 
  partial class Children2:form 
  {public 
    Children2 () 
      { InitializeComponent (); 
    } 
 
    private void Button2_Click (object sender, EventArgs e) 
    {close 
      (); 
    } 
 
    private void S (object sender, EventArgs e) 
    { 
    } 
  } 
}</span> 

The code for the full subform Children2 (User password modification form) is:

<span style= "FONT-SIZE:18PX;" >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 WindowsForms 
{public 
  partial class Children3:form 
  {public 
    Children3 () 
      { InitializeComponent (); 
    } 
 
    private void Button2_Click (object sender, EventArgs e) 
    {close 
      (); 
  } 
}} </span> 

The interface to open the subform on the Student Information Management System Main page is:

Found in the file you write the program, open EXE run Student Information Management system, test whether and their own design imagine what different, different words to modify and debug, until the results with their own expected to coincide with it.

The above is the entire content of this article, I hope to help you learn.

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.