0

pnl1 contains textboxes and a button(btnToPanel2). Upon clicking the button, it should disable pnl1 and show pnlValidatePanel1.

pnlValidatePanel1 contains 2 buttons -- Agree & Decline

Clicking on Agree should hide pnlValidatePanel1 (its container) and show pnl2. However, when I click on it, it only hides the previous panel but does not show pnl2. It shows the form instead (which was blank as I've only put the controls in the panels).

I already tried with the visibility property of the panel but it still has the same result.

As I'm still new to programming and using vb, I want to find a way to avoid using multiple forms with different controls that's why I tried using panels.

   Private Sub btnToPanel2_Click(sender As Object, e As EventArgs) Handles btnToPanel2.Click
        pnlValidatePanel1.Show()
        pnlValidatePanel1.Location = New Point(128, 248)
        pnlValidatePanel1.BringToFront()

        pnl1.Enabled = False
    End Sub

    Private Sub btnValidatePanel1Agree_Click(sender As Object, e As EventArgs) Handles btnValidatePanel1Agree.Click
        pnlValidatePanel1.Hide()
        pnl1.Hide()

        pnl2.Show()
        pnl2.Location = New Point(0, 0)
        pnl2.BringToFront()
        
    End Sub

    Private Sub btnValidatePanel1Decline_Click(sender As Object, e As EventArgs) Handles btnValidatePanel1Decline.Click
        pnlValidatePanel1.Hide()

        pnl1.Enabled = True

    End Sub

UPDATE: I removed the pnl1.Hide() in the btnValidatePanel1Agree event and it now proceeds to pnl2 successfully.

smzh_
  • 29
  • 5
  • `pnl2` must be not on the same container. Or not on the container you expect it to be. – T.S. Jan 04 '21 at 21:24
  • When I skip the validation process (pnlValidatePanel1) and replace it instead with the pnl2 processes, it works and still has all its controls. – smzh_ Jan 04 '21 at 21:36

0 Answers0