So I have a program which is itself a console application, but which manages a few forms. The primary form has the ability to launch a secondary form, and I want it to be able to launch more than one of it's secondary forms.
The trouble is when I use the modal command Form.ShowDialog()
, I can't navigate away from the secondary form and access the primary one, therefore I can't launch a second secondary.
The trouble I'm running into with Form.Show()
, is as soon as the form is launched it closes again. Sure, it runs the initial function, but then it immediately vanishes. What is the best way to approach this modeless display, but keep the forms around?
EDIT: Here is a bit of the format I'm working in. I have a self-defined Process class which handles the forms, each process stored in a list in the console app, and each with it's own myFORM
public class Process
{
/*The process class is used to track all running processes related to GeFoss(any forms or consol apps, etc)
* Methods:
* -initialize: This has two overloads, one for a form, and one for general objects. Basically this just starts the main part of the app
* -ShowDialog: This simply calls the Form.ShowDialog method if the process controls a Form
* -_NewThread: Begins a new thread centered on Leo
* -Leo: simply launches another copy of the same Object
*/
public Form myFORM;
public Type mytype;
.
.
.
.
.
. .
.
.
public void ShowDialog()
{
//This should only be called when the type of Process is a form. If it isn't a form though, the try-catch will prevent a crash
try
{
myFORM.Show();
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex));
}
}\
\
EDIT: I was able to find a work-around. As the project I'm working on is sort of like a simulated OS, I told it to launch the main GUI Form using Form.ShowDialog(), and all the following forms using Form.Show(), and this seems to be working for me