获取另一个窗体中一个窗体的所有控件名称
我有两个表单,分别称为 Customers 和 CustomerControlList 在客户表单中,我有 DevExpress 布局控件,如 TabbedControlGroup、LayoutControlGroup、LayoutItem,在这些 LayoutItems 中,我使用任何控件,如 TextEdit、ComboEdit 等...
并且我想获取 CustomerControlList 中的所有控件名称,即 TextEdit 等... 那么我该怎么做呢?我无法迭代这些布局控件...
例如:我获取类似表单的实例并循环遍历
frmCustomer fc= new frmCustomer();
foreach(Control c in fc.Controls)
{
}
这不起作用,仅包含 Windows.Forms.Collection,因此它作为控件计数为零。
还可以以另一种形式获取动态创建的控件名称吗? 如果是这样,该怎么做?
谢谢!
I have two forms that are called Customers and CustomerControlList
In Customers Form, I have DevExpress Layout Controls like TabbedControlGroup, LayoutControlGroup, LayoutItem and in those LayoutItems I use any control like TextEdit, ComboEdit, etc...
And I want to get all control names which is TextEdit, etc... in CustomerControlList
so how can I do that? I can not iterate through these layout controls...
For Example: I get instance of form like and loop through
frmCustomer fc= new frmCustomer();
foreach(Control c in fc.Controls)
{
}
this doesn't work, Only comes Windows.Forms.Collection so it comes zero as control count.
Also is that possible to get dynamically created controls' names in another form?
if so, how to do that?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我有用(这几乎是我的代码的直接内容):
this worked for me (this is almost a straight rip from my code):