Didn't your momma ever tell you that "can't never did anything". What's the first thing you have to do? Answer: write a program with main() function. Next: create a loop that counts from 0 to 5. Do you know what a loop is? If not, then read your textbook and it will tell you with examples.
Did you write that code you posted or not? My guess is you got it from someone else. Study the code and think about what it is doing. Then see if you can see how to rearrance a few lines to make it do what you want it to do. If you don't understand the program you posted then I don't know how we can help you.
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 ...