I am going mad trying to sort this logic out lol

Public Sub Panels()
        If RadPanelSearchCur.Visible = True Then
            RadPanelTenant.Visible = False
            'RadPanelProp.Visible = False
            RadPanelTenantEdit.Visible = False

        ElseIf RadPanelTenant.Visible = True Then
            RadPanelSearchCur.Visible = False
            'RadPanelProp.Visible = False
            RadPanelTenantEdit.Visible = False

        ElseIf RadPanelAddTenant.Visible = True Then
            RadPanelSearchCur.Visible = False
            '    RadPanelTenant.Visible = False
            RadPanelTenantEdit.Visible = False

        ElseIf RadPanelTenantEdit.Visible = True Then
            RadPanelSearchCur.Visible = False
            RadPanelTenant.Visible = False
            'RadPanelProp.Visible = False
            'RadPanelt()

            'ElseIf

        End If

the idea is if one panel is opened the others are closed

thanks

M

Recommended Answers

All 3 Replies

Why don't you just make it where if you click a button, it will show Panel2 and hide all the other panels? Like so:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Panel2.Show()
        If Panel2.Visible = True Then
            Panel1.Visible = False
            Panel3.Visible = False
        End If
    End Sub

And just keep the same premise as you code the other buttons.

That's kind of what I had I just wanted a central place to edit the different states

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        setPanelVisibility(Panel2, Panel1, Panel3)
    End Sub
    Private Sub setPanelVisibility(ByVal visiblePanel As Panel, ByVal notVisiblePanel1 As Panel, ByVal notVisiblePanel2 As Panel)
        visiblePanel.Visible = True
        notVisiblePanel1.Visible = False
        notVisiblePanel2.Visible = False
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.