I saw this article on this website todayArticle: "C # How to implement access between two winforms ".CodeThe test can indeed be implemented, but we do not know whether a problem has been found. the person who wrote this article made the problem worse. why. please refer to my solution to this problem.
Everyone knows that object-orientedProgramOne feature of the design is polymorphism. One is encapsulation and the other is inheritance. At last, we do not need to explain it. The implementation method is as follows:
1. inherit a form1 class from form.
2. inherit a form2 class from form.
3. Add a member variable in 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 form2. The corresponding Event code is:
{
Frmparent. Text = "success or failure rewriting ";
}
In this simple way, the communication between form and form is completed. How simple is it, right! I hope I can get to know some C # experts through this article. I am also a C # programmer. I wrote this article because I saw this article leading everyone to the misunderstanding. don't be surprised when I ask the younger brother to see it.
My email is Givectl521@163.com MSN: xyheart_2006@hotmail.com hope to do. NET development friends can make friends, learn from each other.