OIC!! the complex class is being initialised with no params when you use it like that - so you need to code a default constructor (one with no parameters). This should be standard practice but try adding:
/* INSIDE the complex class */
real = imag = 0;
This means when you use complex as a type/cast it will set real and imag to zero until you do anything with it - which wont matter in your case. Try the code.
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 ...