I'm having a problem with user control..
how can i disable from the panel the user control if another user control is selected from menustrip???

here is my code at the moment

Private Sub LabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LabToolStripMenuItem.Click
        If LabToolStripMenuItem.Enabled = True Then
            Dim fmLabModuleUC As New LabModuleUC()
            fmLabModuleUC.Dock = DockStyle.Fill

            Panel1.Controls.Add(fmLabModuleUC)

            fmLabModuleUC.Show()

        End If
        If LabToolStripMenuItem.Enabled = False Then
            Panel1.Controls.Clear()
        End If
    End Sub

hope you'll help me with this..
God bless!

Recommended Answers

All 3 Replies

Remove te offending cotrol from the Panel.Controls collection, or fully clear the panel.Controls before adding the new user control.

Hope this helps

hi lola! thanks! you really helped me! :)

I would appreciate if you mark the thread as solved.

TIA

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.