Navigating embedded UserControl forms inside a Windows Forms Panel

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
 
D

Dmitriy Lapshin [C# / .NET MVP]

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.
 

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