Just a note: the above code can be used with either a Class or a Struct, which you use depends on curcumstances and design requirements. The short difference between class and struct is that structs are a value type whilst calsses are reference. The debate about which to use when runs way too deep to cover here, but its worth reading into.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...