User Controls

M

Michael Turner

Hi I have created a usercontrol that has a menu system that I have created,
the menu has an on click event but what I need to do is when this is placed
on the application, when clicked it needs to run a sub procedure that is in
the application that starts another control that opens in a panel.

What I think I need to do is handle the controls events in the application,
but I dont know. This is the first time I have had a need to use these user
controls so have very limited knowledge so any help would be very much
appreciated.
 
O

OpticTygre

Hi,

I just had to deal with the same kind of issue with a treeview control and
panels Maybe you can take some of this code and put it to use:

Private Sub ConfigList_AfterSelect(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.TreeViewEventArgs) Handles ConfigList.AfterSelect
Dim myControl as UserControl

Panel1.Controls.Clear()

Select Case e.Node.Tag
Case "1"
myControl = New UserControl1
Case "2"
myControl = New UserControl2
Case "3"
myControl = New UserControl3
End Select

myControl.Parent = Panel1
myControl.Show()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top