Assuming this is WinForms application (if is not then see the comment from Andy Lanng)
I created a form with two groupboxes, one button and placed a textbox in the first groupbox. All controls were left with their default names.
The following code moves the text box between the groupboxes on the button click
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If TextBox1.Parent Is GroupBox2 Then
TextBox1.Parent = GroupBox1
Else
TextBox1.Parent = GroupBox2
End If
End Sub
Note that the test has to use
Is
instead of
=
otherwise you will get a compile error
Quote:
Operator '=' is not defined for types 'System.Windows.Forms.Control' and 'System.Windows.Forms.GroupBox'.