|
-
Dec 8th, 2015, 02:08 PM
#1
Thread Starter
Junior Member
Change User Control associated within a panel from another User Control
In my app, I have three panels that make up the main screen. A header panel, a Navigation panel and a Main display panel.
When user clicks on the navigation button in nav panel, I use the following code to display the proper user control in main panel
Dim tempobject as new [usercontrol]
pnlMain.Controls.Clear()
pnlMain.Controls.Add(tempobject)
If I were to have a user control that contained sub menu items from a button in the nav panel,how would I call a new UC to the pnlMain if I am already in a UC in pnlMain?
Also, how would I create a generic function to accept a usercontrol (one that I want to display in pnlMain) as a parameter and display in pnlMain?
Something like this?
Public Sub GetUserControl(uc as System.Windows.Forms.Control)
Dim tempobject as new uc
pnlMain.Controls.Clear()
pnlMain.Controls.Add(tempobject)
That code isnt working, Getting error "value of type 'uc' cannot be converted to 'System.Windows.Forms.Control'
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|