Never use Application.DoEvents() -- it has way too many unintended effects. If your application is in the middle of a long-running loop and you use .DoEvents() to force the form to update it will also allow them to click on the "X" in the top-right and close the form/application, for example. Handle these operations in another thread and report progress back to the GUI.
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 ...