|
|
Title | Reparent a control in VB .NET |
Keywords | reparent, set parent, parent |
Categories | VB.NET, Software Engineering |
|
|
Simply set the control's Parent property to its new parent.
Note that the control may end up on the bottom of the new parent's stacking order so you may want to call its BringToFront method to pop it to the top.
|
|
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Parent Is GroupBox1 Then
Button1.Parent = Me
Else
Button1.Parent = GroupBox1
End If
Button1.BringToFront()
End Sub
|
|
|
|
|
|