Navigating embedded UserControl forms inside a Windows Forms Panel

  • Thread starter Thread starter Emma Middlebrook
  • Start date Start date
E

Emma Middlebrook

Hi,

I've created a form that has basic navigation functionality. There is
a panel on the main form that contains several UserControl form
objects.

I've added all the forms to the control collection and can quite
happily navigate through displaying the panels as and when I need
them. The issue I have is that when the user clicks on one of my
buttons on the navigation form it will do 1 of two operations based on
the user control that is currently being shown in the panel.

Is there a way to identify what UserControl the panel currently has at
the front? I can't seem to get anything to work...

regards

Emma Middlebrook
 
Hi Emma,

I believe it would be much better to introduce a variable (best of all
having a type of a dedicated enum, say, ActivePanel) and track the active
panel in this variable.
You of course possibly could walk through ZOrder of the controls contained
by the panel, but this looks like a kind of 'hack' to me.
 
Back
Top