I have two forms that are called Customers and CustomerControlList In Customers Form, I have DevExpress Layout Controls like TabbedCon开发者_如何学PythontrolGroup, 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!
this worked for me (this is almost a straight rip from my code):
TextEdit devXtextControl;
foreach (Control control in this.Controls[0].Controls)
{
if ((devXtextControl = control as TextEdit) != null)
{
// do something with devXtextControl
Messagebox.Show(devXtextControl.Name);
}
}
精彩评论