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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop through panels to find visible panel

Status
Not open for further replies.

mbair

Programmer
Aug 13, 2003
22
US
How can I loop through my panels and find the one that is visible. Then take that panel id and loop through the controls on the panel?
 
You have to do something like this:
Code:
Private Sub IterateThroughChildren(ByVal parent As Control)
   Dim c As Control
   For Each c In parent.Controls
      If c.GetType().ToString().Equals("System.Web.UI.WebControls.Panel") Then
         Dim pan As Panel
         pan = CType(c, Panel)
         If pan.Visible = TRUE Then
            ''Do Stuff Here
         End If
      End If

      If c.Controls.Count > 0 Then
         IterateThroughChildren(c)
      End If

   Next c
End Sub

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top