Since you're passing a
reference, not a copy of the page, there is not that much overhead. But if you know it's going to be a label, pass a label:
(ASPX Page)
Dim MyLabel1 As Label
DetermineVisibility(MyLabel1, true)
(Sub Routine)
Public Sub DetermineVisibility(ByRef TheLabel As Label, condition As Boolean)
If condition Then
TheLabel .Visible = True
Else
TheLabel .Visible = False
End If
End Sub
This way, you have strongly typed reference to a Label instance, so you could set other Label specific properties / methods as well.
If you want a generic method that can handle Textboxes, buttons and so on as well, change the type of the TheLabel variable to Control.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Missed by
P.J. Harvey (Track 2 from the album:
Rid Of Me)
What's This?