E
Ethan Strauss
I am (still) relatively new to Windows applications, most of my experience
has been Web based, and I am confused about what exactly happens when the
Main() method is called and how to manipulate forms opening & closing.
An example of this issue is as follows. I have a logon form open as the
first thing. The main functional form opens when a user has successfully
logged on. From the main form, a user should be able to logout which will
reshow the logon form and the state should be essentially identical to if
they have never logged on in the first place. What I find is that I can't
close any form in this string, or everything shuts down, so I have to hide
forms. But if I do that, then they still lurk in the background and do
strange things.
I have been thinking that I should make an orchestrator class with a method
something like this
public void ReplaceCurrentlyShownForm(Form toOpen, Form currentlyOpen)
{
currentlyOpen.Close();
currentlyOpen.Dispose();
toOpen.Show();
}
and have Main instantiate this class which then runs until the whole app is
closed down.
Would that make sense?
I have been looking for examples of code in which different windows forms
are show at different times in the program, but I have not yet found
anything. If you could point me to something, that would be helpful.
Thanks!
Ethan
has been Web based, and I am confused about what exactly happens when the
Main() method is called and how to manipulate forms opening & closing.
An example of this issue is as follows. I have a logon form open as the
first thing. The main functional form opens when a user has successfully
logged on. From the main form, a user should be able to logout which will
reshow the logon form and the state should be essentially identical to if
they have never logged on in the first place. What I find is that I can't
close any form in this string, or everything shuts down, so I have to hide
forms. But if I do that, then they still lurk in the background and do
strange things.
I have been thinking that I should make an orchestrator class with a method
something like this
public void ReplaceCurrentlyShownForm(Form toOpen, Form currentlyOpen)
{
currentlyOpen.Close();
currentlyOpen.Dispose();
toOpen.Show();
}
and have Main instantiate this class which then runs until the whole app is
closed down.
Would that make sense?
I have been looking for examples of code in which different windows forms
are show at different times in the program, but I have not yet found
anything. If you could point me to something, that would be helpful.
Thanks!
Ethan