In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to accurately realize the communication between C#form and form. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
It is not easy to realize the communication between C # form and form. The author found a solution on the Internet, but found that it did not solve the problem. After some research, the author solved this problem. The following is how to achieve the method to share with you.
As we all know, one of the characteristics of object-oriented programming is polymorphism, one is encapsulation, and the other is inheritance. The implementation method is as follows:
1. Inherits a form1 class from form.
two。 Inherits a form2 class from form.
3. Add a member variable to the form2 class: frmParent
4. Add an overloaded constructor to the form2 class: public form2 (Form1 Parent) {frmParent=Parent}
5. Add a Button object to form1. The corresponding event code is:
{Form2 frm=new Form2 (this); frm.Show ();}
6. Add a Button object to the form2, and the corresponding event code is:
{frmParent.Text= "success or failure rewriting";}
It is so simple to complete the communication between C # form and form. How simple it is, isn't it?
After reading the above, do you have any further understanding of how to accurately realize the communication between C#form and form? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.