Reputation: 99
For example, in visual basic
Dim VariableName As String
VariableName = "button1"
VariableName.Visible = true
Would set button1 to be visible.
Edit: I got it!
Me.Controls(variableName).Visible = True
Upvotes: 1
Views: 4004
Reputation: 330
Well VariableName is a string, and strings don't have a a property called "visible".
You want to get the actual Button itself. One way you could do that is something like (untested):
dim btn as Button
for each c in Controls
if c.name = "button1" then
btn = c
end if
next
btn.visible = true
Edit: OP found a better solution, although this could work if you were looking for a textbox with a particular "text" property or something along those lines.
Upvotes: 1