Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Controls

Status
Not open for further replies.

rvBasic

Programmer
Oct 22, 2000
414
BE
Panel2 of a SplitContainer (spcBody) may or may not contain controls that are visible. Under certain conditions I want all controls to be invisible. I wrote following piece of code:
Code:
[COLOR=green]'if there are controls on the panel to the right of the splittercontrol,
        'then hide them[/color]
        Select Case Me.spcBody.Panel2.Controls.Count > 0
            Case True
                For Each ctrl In Me.spcBody.Panel2.Controls
                    [COLOR=red]ctrl.visible = False[/color]
                Next
            Case False
                [COLOR=green]'do nothing[/color]
        End Select

The red statement is however flagged with an error: Option Strict On disallows late binding

What is the correct statement to perform the task?

_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 

How did you declare [tt]ctrl[/tt]?
Did you try:
Code:
For Each ctrl [blue]As Control[/blue] In Me.spcBody.Panel2.Controls                          
ctrl.visible = False                
Next

Have fun.

---- Andy
 
That did it, thanks

_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top