Getting the name property of a control

moster67

Expert
Licensed User
Longtime User
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:

B4X:
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
never mind - I resolved it.

I just needed to get rid of the keyword ControlType like this:

B4X:
r=r & names(i) & CRLF

silly me.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…