开发者

winForms, referencing to a text box and button from a class

I really need help with referencing from a class to a text box and bu开发者_JS百科tton on a form using the declared names of the boxes and buttons.

example:

say you have a box called testBox that is located in Form1 i am in the testingBox Class and i need to write:

testBox.AppendText("Test Box");

but the syntax error is: "The name 'testBox' does not exist in the current context"


You need to pass the controls to your class using constructor parameters and private fields.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜