从另一个类调用表单控件???????

编程入门 行业动态 更新时间:2024-10-11 01:20:34
本文介绍了从另一个类调用表单控件???????的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 这应该很简单。我有一个名为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

更多推荐

从另一个类调用表单控件???????

本文发布于:2023-11-02 09:59:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552076.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   控件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!