How do you pass values between forms in C #?

Source: Internet
Author: User

1. When you customize the form, add the appropriate properties for the form, such as:
Class myform:form{
....
private string something;
public string Something{get{return Something;} Set{something=value;}}
}
By passing a value similar to this property: Form1. Something=xxx

2, the other is to create a middleware to store data, such as the creation of a record class:
Class record{
public static string Something;
}
Two forms cross-pass values when setting and calling values through Record.something:
For example, call record.something= "Something" in Form1 to set the value to pass, call in Form2
Xxx=record.something to receive the value that came

How do you pass values between forms in C #?

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.