Also, how do I use one function to change the user control that is displayed in my frmMain.pnlMain?

I was using:

Dim tempobject as new [usercontrol]
pnlMain.Controls.Clear()
pnlMain.Controls.Add(tempobject)

I had this on each button in the navigation panel and it would change user controls in pnlMain as called. I also want to call changes to the main panel from a user control that is already in the main panel (like drilling down to lookup tables). Instead of referencing the main form. main panel, could I just call my one function that would perform the above code, but the usercontrol would be passed in via parameter?




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'