Using C # to implement data transfer between forms

Source: Internet
Author: User

A slightly more complex program typically has two or more forms. Sometimes in programming, data is passed not only in the same form, but also between forms, which are passed between the main form and the data from the form. Starting with this article, we'll enumerate four scenarios for data transfer between different forms, and how to implement these four scenarios with Visual C #. The first case of passing data between forms by using Visual C # is described below-passing strings from the main form to the form. After reading this article, you also try to use this method to transfer data between forms.

The software environment for programming, debugging and running in this paper:

Windows2000 Server Edition

Visual Studio.NET official edition,. Net FrameWork SDK version number 3705

Implementation steps:

1. Start visual Studio. Net

2. Select Menu "File" | "new" | "Project", pop-up "New Project" dialog box

3. Set "project type" to "Visual C # project"

4. Set "template" to "Console Application"

5. In the Name text box, enter the data delivery method for different forms in vc# 01

6. In the "Position" text box, enter "E:\VS." NET project, and then click the OK button so that the data delivery Method 01 project for different forms in vc# is created and completed

7. Switch the current window of Visual Studio.NET to the Form1.cs window, and drag the following components into the Form1.cs form from the Windows Forms tab in the Toolbox and perform the appropriate actions:

· Two textbox component for entering data sent to the Form2 form

· Two label components

· A button component with the name Button1 and, after dragging into the Form1.cs form, double-click it, Visual Stuido. NET produces the processing code corresponding to its click event.

Related Article

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.