The cast to a wide string type should raise red flags. Perhaps you should consider wchar_t and swprintf from the get-go instead of trying to drop narrow characters into wide holes and hoping for magic.
>I just wanted to check i was doing the right thing
Very rarely is there one "right thing". I can think of at least half a dozen ways to tackle the problem you were having, and I can guaran-damn-tee that kind of insight doesn't come from having other people solve your problems for you.
>Otherwise it would take many posts if it didnt work
And imagine how much you could have learned in that process that you have now missed out on...
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 ...