It works for me. What version of vb are you using (I am on vb 2010)? If you added the code after double clicking the picturebox then the code won't execute until you click in the picturebox at run time. Try putting it in the form load handler.
This is what i mean. When i debug the program it shows the labels like this, and the only way to make the text visible is to click on it. How do i make it so the text is visible without having to click it every time?
Here's an example. I created a blank form, added a picturebox, then added a label at the centre of the picturebox. Note that even though the label is over the picturebox, it is actually containied in Me.Controls. In the following code, only the line that has the comment "run time" actually has to be in the code. The other three lines set properties that can be set in the designer. This code gets executed when the form loads and does not require that you click on anything.
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.BackColor = Color.Azure 'design time
PictureBox1.BackColor = Color.Coral 'design time
Label1.BackColor = Color.Transparent 'design time
Label1.Parent = PictureBox1 'run time
Your problem was that when you double clicked on the picturebox in the designer it automatically created a handler for PictureBox1_Click. That is where you added your code and that is why you had to click on the control to execute that code at run time.
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 ...