C # WinForm passing controls as parameters

Source: Internet
Author: User

Recently, to do a WinForm program, you need to pass the form's control as a parameter to another class of functions to use, each time forget, simply write down, for immediate viewing.

1. Set the Modifier property of the control to public

2. Take the space name as a parameter

3. Using System.Windows.Forms in the classes that need to be used;

3. In another class, you can directly declare variable columns of the control type, such as: TextBox, SaveFileDialog, ListView, and other control types

This allows you to move away from the form program, manipulate the control properties of the form in other classes, and facilitate the transfer and control of parameters between forms and forms, and between forms and other classes.

C # WinForm passing controls as parameters

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.