-
Here is what I want to do:
When I click on a command button, I want to assign the component object Command1 to a variable and then use it by the variable name.
Like this:
C1 = Command1
and then say:
C1.caption = "Click Here"
Can someone give me an example of how to do this? I tried assigning C1 as Object and say C1 = Command1 but that does not work.
Thanks in advance for your help!
-
assign it as a commandbutton. You can't use default properties if you declare them as objects/controls, but you can of course do C1.Caption = "Click Here"
-
Great, thanks!
There is no type I can assign C1 to that will work for alll components? I wanted to make a routine to use the same object/variable public in the app. Guess I can pass to the routine the variable and then a flag to tell which type it is like commandbutton, etc.
-
Well you can pass it as control as well as object and then check the Typename of it, put it in a select case:
Code:
Select Case TypeName(C1)
Case "CommandButton"
Case "TextBox"
Case Else
End select