moster67 Expert Licensed User Longtime User Mar 22, 2010 #1 Probably there is a simple answer to my question but then I have failed to see it... I'd like to get the name property of all controls on a form i.e. txtMyname, lblMyLabel. I have tried this code: Code: Copy Sub Globals Dim names(0) End Sub Sub frmStreamProfiles_Show names() = GetControls("frmStreamProfiles") For i = 0 To ArrayLen(names())-1 r=r & ControlType(names(i)) & CRLF Next Msgbox(r) End Sub But above code only gives me the type of the ojects such as textbox, label, checkbox which probably is natural since I am using ControlType(names(i)). Anyone who can help me showing how to obtain the name property of each control I have placed on a form? Thanks
Probably there is a simple answer to my question but then I have failed to see it... I'd like to get the name property of all controls on a form i.e. txtMyname, lblMyLabel. I have tried this code: Code: Copy Sub Globals Dim names(0) End Sub Sub frmStreamProfiles_Show names() = GetControls("frmStreamProfiles") For i = 0 To ArrayLen(names())-1 r=r & ControlType(names(i)) & CRLF Next Msgbox(r) End Sub But above code only gives me the type of the ojects such as textbox, label, checkbox which probably is natural since I am using ControlType(names(i)). Anyone who can help me showing how to obtain the name property of each control I have placed on a form? Thanks
moster67 Expert Licensed User Longtime User Mar 22, 2010 #2 never mind - I resolved it. I just needed to get rid of the keyword ControlType like this: Code: Copy r=r & names(i) & CRLF silly me.
never mind - I resolved it. I just needed to get rid of the keyword ControlType like this: Code: Copy r=r & names(i) & CRLF silly me.