I have a strange issue, and I believe this is the right forum for it.
I have a form which contains a TabControl with 2 pages, which contains multiple GroupBoxes, which each contain a single TableLayoutPanel, which then each contain multiple Labels, Buttons, and Textboxes. I am using code which searches down to the bottom level in order to find said Labels, Buttons, and Textboxes, and then performs some action on them.
When use this code to perform operations on Buttons and Textboxes, it seems to work fine. When I use this code to do something with Labels, at some point the loop seems to just exit for no reason. The code which does this is shown below-
What happens is this- after getting to the 5th or 6th Groupbox (and subsequent TableLayoutPanel), I can see that the selection of Labels has been properly identified as shown in here-
But after it performs the operation for the first Label (Text= "ODxWT"), the loop simply exits. There is no Build error, no Runtime error, no notification whatsoever. Anyone seen this before?
I have a form which contains a TabControl with 2 pages, which contains multiple GroupBoxes, which each contain a single TableLayoutPanel, which then each contain multiple Labels, Buttons, and Textboxes. I am using code which searches down to the bottom level in order to find said Labels, Buttons, and Textboxes, and then performs some action on them.
When use this code to perform operations on Buttons and Textboxes, it seems to work fine. When I use this code to do something with Labels, at some point the loop seems to just exit for no reason. The code which does this is shown below-
VB.NET:
Dim pg As System.Windows.Forms.TabPage, ctrl As System.Windows.Forms.Control, cctrl As System.Windows.Forms.Control,
ccctrl As System.Windows.Forms.Control
For Each pg In TabControl1.TabPages
For Each ctrl In Me.TabControl1.TabPages(pg.Name.ToString).Controls
If (TypeOf ctrl Is System.Windows.Forms.GroupBox) Then
For Each cctrl In ctrl.Controls
If (TypeOf cctrl Is System.Windows.Forms.TableLayoutPanel) Then
For Each ccctrl In cctrl.Controls
If (TypeOf ccctrl Is System.Windows.Forms.Label) Then
'Perform some action
End If
Next
End If
Next
End If
Next
Next
What happens is this- after getting to the 5th or 6th Groupbox (and subsequent TableLayoutPanel), I can see that the selection of Labels has been properly identified as shown in here-
But after it performs the operation for the first Label (Text= "ODxWT"), the loop simply exits. There is no Build error, no Runtime error, no notification whatsoever. Anyone seen this before?