开发者

How to access a control form from a constructor in another class

开发者 https://www.devze.com 2022-12-25 08:50 出处:网络
C# question: I have a textBox in a default form Form1 and I want to access (write on) it开发者_运维知识库 from a constructor in another class that is in another different file. How can I do it?

C# question: I have a textBox in a default form Form1 and I want to access (write on) it开发者_运维知识库 from a constructor in another class that is in another different file. How can I do it?

Tx in advance, Gerard


You need to make a property in the Form1 class that exposes the textbox or its Text property, then pass an instance of the Form1 class to the constructor. (Or as a static proeprty)

0

精彩评论

暂无评论...
验证码 换一张
取 消