如何访问控制的标签贴在code [英] How to access the label of a control in code
本文介绍了如何访问控制的标签贴在code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常,一个标签控件绑定到一个文本框或其他类似控制。我知道,有一种方法可以访问到code中的标签,但我不记得如何做到这一点。
Often a label control is bound to a textbox or similar other control. I know that there is a way to access the label through code, but I do not remember how to do it.
谁能帮助?
也许是这样的:
Me.txtName.Child!lblName.Value
或
Me.txtName.Parent!lblName.Value
我会用这个当我的控件进行验证一个表单上枚举。然后,我想使用标签的控制,信息错误消息显示错误所在的用户。
I will use this when I am enumerating through the controls on a form for validation purposes. Then I want to use the label for a control as information in the error message to show the user where the error is.
推荐答案
通过文本框,你可以试试
With the textbox you can try
Text0.Controls.Item(0).Caption
如果控制0链接标签
where Control 0 is the linked label
这篇关于如何访问控制的标签贴在code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文