S
Søren Dreijer
Hi,
I realize this is a very common problem, but even though I've scoured the
Internet for resources, I can't seem to solve this issue :|
I currently have a very simple application. It contains a a single main
dialog in which all user interaction occurs. The dialog consists of "views",
that is panels, which contain various controls. Only one panel is shown at a
time. When the user has finished working on one panel, the next should be
shown.
As you probably know, designing all the panels in the main dialog is a pain
as they lie on top of each other.
That's why I instead decided to use UserControls and use a single panel on
the main form as a placeholder.
When the application starts up, the following code is executed and the first
view is shown:
// 'mainPanel' is the placeholder on the main form
// 'View1' is the UserControl
mainPanel.Controls.Clear();
mainPanel.Controls.Add(new View1());
Now, when the user wishes to proceed to the next view, he presses, say, a
button on the view's form (not on the main form).
My question is, how does the view update the main form's panel? I know there
are properties to access the parent form from the UserControl, but so far
I've had no luck accessing the main form's panel :|
Thanks!
I realize this is a very common problem, but even though I've scoured the
Internet for resources, I can't seem to solve this issue :|
I currently have a very simple application. It contains a a single main
dialog in which all user interaction occurs. The dialog consists of "views",
that is panels, which contain various controls. Only one panel is shown at a
time. When the user has finished working on one panel, the next should be
shown.
As you probably know, designing all the panels in the main dialog is a pain
as they lie on top of each other.
That's why I instead decided to use UserControls and use a single panel on
the main form as a placeholder.
When the application starts up, the following code is executed and the first
view is shown:
// 'mainPanel' is the placeholder on the main form
// 'View1' is the UserControl
mainPanel.Controls.Clear();
mainPanel.Controls.Add(new View1());
Now, when the user wishes to proceed to the next view, he presses, say, a
button on the view's form (not on the main form).
My question is, how does the view update the main form's panel? I know there
are properties to access the parent form from the UserControl, but so far
I've had no luck accessing the main form's panel :|
Thanks!