Question

I have created a form. I have put 2 panels on it, namely "Panel1" and "Panel2". I put one button in the "Panel2".

Then I put another button to the form, namely "Button2".

A click on "Button2" executes the following code:

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

    Me.Panel2.Parent = Me.Panel1
    ' Me.Panel1.Location = New Point(0, 0) this does not work either

End Sub

When I click "Button2", "Panel2" simply disappears. I expected "Panel2" to be placed within "Panel1", but it is not shown there.

Does anybody see what I did wrong?

Thank you for the help!

Was it helpful?

Solution

you need to set the position of the other pannel:

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

    Me.Panel2.Parent = Me.Panel1
    Me.Panel2.Location = new point(0,0)

End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top