You can't use the modulus on doubles, there is a function called fmod for that, but I don't know if that's going to get you any further along. Let the thread sit for a bit and see if someone remembers something I'm missing.
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 ...