大家好, 这应该很简单。我有一个名为frmInterface的表单。在这张表格上我 有一个名为lblStatus的标签。我想更改此标签的TEXT从 另一个类。 例如 nsInterface.frmInterface objTemp = new nsInterface.frmInterface; objTemp.lblStatus.text =" etc etc" ;; frmInterface类和lblStatus控件都是公共的。 我运行程序lblStatus中的文本没有改变 - 为什么??????? 提前谢谢。 - 通过 www.dotnetmonster 发布的消息
Hi all, This should be simple. I have a form called frmInterface. On this form I have a label called lblStatus. I want to change the TEXT of this label from another class. For example nsInterface.frmInterface objTemp = new nsInterface.frmInterface; objTemp.lblStatus.text = "etc etc"; Both the frmInterface class and lblStatus control are public. When I run the program the text in lblStatus doesnt change - why??????? Thanks in advance. -- Message posted via www.dotnetmonster
推荐答案公共成员是实例成员。为了在一个实例上操纵一个公共成员 ,该类必须能够访问 所在的实例。 - HTH, Kevin Spencer 微软MVP ..Net开发人员 观看时钟永不沸腾。 " Jon S via DotNetMonster" < u2272 @乌韦>在消息中写道 news:56aad5e954e85 @ uwe ... Public members are instance members. In order to manipulate a public member on an instance, the class must have access to the instance in which it resides. -- HTH, Kevin Spencer Microsoft MVP ..Net Developer A watched clock never boils. "Jon S via DotNetMonster" <u2272@uwe> wrote in message news:56aad5e954e85@uwe... 大家好, 这应该很简单。我有一个名为frmInterface的表单。在这张表格上我有一个名为lblStatus的标签。我想从另一个类改变这个标签的TEXT 例如 nsInterface.frmInterface objTemp = new nsInterface.frmInterface; objTemp.lblStatus.text =&etc; etc etc" ;; frmInterface类和lblStatus控件都是公共的。当我运行程序时,lblStatus中的文本不会改变 - 为什么??????? br /> 提前致谢。 - 通过 www.dotnetmonster
嗨凯文, 感谢您的回复。我不太明白。从我所看到的 一切都是公开的,因此应该有访问权 - 我是否正确思考 这个????? BTW我为nsInterface创建对象的代码行。 frmInterface objTemp = etc ...在它的末尾有()。我在最初的消息中留下了这个 。 谢谢。 - 留言通过DotNetMonster发布 http ://www.dotnetmonster/Uwe/For...sharp/200510/1 Hi Kevin, Thanks for replying. I''m not quite getting it. From what I can see everything is public so therefore should have access-am I right in thinking this????? BTW the line of code where I create an object for the nsInterface. frmInterface objTemp = etc... does have () at the end of it. I left this out in the initial message. Thanks. -- Message posted via DotNetMonster www.dotnetmonster/Uwe/For...sharp/200510/1
它应该是: nsInterface.frmInterface objTemp = new nsInterface.frmInterface; objTemp.Show(); ... 。 .... objTemp.lblStatus.text =" etc etc" ;; 这就是你所拥有的? 欢呼, - Ignacio Machin, ignacio。 machin AT dot.state.fl.us 佛罗里达州交通局 " Jon S via DotNetMonster" < u2272 @乌韦>在消息中写道 news:56aad5e954e85 @ uwe ... Hi, It should be: nsInterface.frmInterface objTemp = new nsInterface.frmInterface; objTemp.Show(); .... .... objTemp.lblStatus.text = "etc etc"; Is that what you have? cheers, -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Jon S via DotNetMonster" <u2272@uwe> wrote in message news:56aad5e954e85@uwe... 大家好, 这应该很简单。我有一个名为frmInterface的表单。在这张表格上我有一个名为lblStatus的标签。我想从另一个类改变这个标签的TEXT 例如 nsInterface.frmInterface objTemp = new nsInterface.frmInterface; objTemp.lblStatus.text =&etc; etc etc" ;; frmInterface类和lblStatus控件都是公共的。当我运行程序时,lblStatus中的文本不会改变 - 为什么??????? br /> 提前致谢。 - 通过 www.dotnetmonster
更多推荐
从另一个类调用表单控件???????
发布评论