Click here to Skip to main content
15,913,159 members
Home / Discussions / C#
   

C#

 
AnswerRe: Run Multiple Forms Pin
share_holder21-Aug-11 23:53
share_holder21-Aug-11 23:53 
GeneralRe: Run Multiple Forms Pin
BillWoodruff22-Aug-11 3:44
professionalBillWoodruff22-Aug-11 3:44 
AnswerRe: Run Multiple Forms Pin
share_holder22-Aug-11 1:14
share_holder22-Aug-11 1:14 
GeneralRe: Run Multiple Forms Pin
Not Active22-Aug-11 2:14
mentorNot Active22-Aug-11 2:14 
GeneralRe: Run Multiple Forms Pin
share_holder22-Aug-11 21:16
share_holder22-Aug-11 21:16 
AnswerRe: Run Multiple Forms [modified] Pin
BillWoodruff22-Aug-11 3:17
professionalBillWoodruff22-Aug-11 3:17 
GeneralRe: Run Multiple Forms Pin
share_holder22-Aug-11 21:15
share_holder22-Aug-11 21:15 
GeneralRe: Run Multiple Forms Pin
BillWoodruff22-Aug-11 21:28
professionalBillWoodruff22-Aug-11 21:28 
Hi, one idea that may be useful if you are required to instantiate all eight forms when the Application starts, rather than creating them on-the-fly in response to events or input: which means you must call 'Show for each Form in your Program.cs static Main method:

You may need to implement control over whether or not one, or more, of your eight forms can be closed, or not: since, if closed, they will have to be re-instantiated by using 'Show again: here's an example of one possible way to handle that case:
C#
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
   (sender as Form).Hide(); // don't close the Form, hide it
    e.Cancel = true;
}

However, in my opinion, if you really don't want the user to close a Form, then best to create the Form without a ControlBox ... but that leaves you with the issue of how, if you allow it, the user can hide forms.

The issue of how to best manage a WinForms application with multiple independent Forms is a very interesting one, and I hope to publish a CP article in the next month on that issue.

One strategy to consider is to have a static class that functions as a Form manager, to which Form events are routed, and in which messages between Forms are dispatched.

best, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges

GeneralRe: Run Multiple Forms Pin
share_holder22-Aug-11 21:33
share_holder22-Aug-11 21:33 
GeneralRe: Run Multiple Forms Pin
share_holder23-Aug-11 1:39
share_holder23-Aug-11 1:39 
Questiontwo use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
BillWoodruff21-Aug-11 22:28
professionalBillWoodruff21-Aug-11 22:28 
AnswerRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
BobJanova21-Aug-11 22:49
BobJanova21-Aug-11 22:49 
AnswerRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
Dave Kreskowiak22-Aug-11 2:07
mveDave Kreskowiak22-Aug-11 2:07 
GeneralRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
BillWoodruff22-Aug-11 3:28
professionalBillWoodruff22-Aug-11 3:28 
GeneralRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
Dave Kreskowiak22-Aug-11 4:10
mveDave Kreskowiak22-Aug-11 4:10 
GeneralRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
Shameel22-Aug-11 4:22
professionalShameel22-Aug-11 4:22 
GeneralRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
Dave Kreskowiak22-Aug-11 5:57
mveDave Kreskowiak22-Aug-11 5:57 
AnswerRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
PIEBALDconsult22-Aug-11 2:45
mvePIEBALDconsult22-Aug-11 2:45 
AnswerRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro PinPopular
Luc Pattyn22-Aug-11 3:09
sitebuilderLuc Pattyn22-Aug-11 3:09 
GeneralRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
Shameel22-Aug-11 4:52
professionalShameel22-Aug-11 4:52 
AnswerRe: two use-cases that do not (surprise) cause a compiler error in VS 2010 Pro Pin
Shameel22-Aug-11 4:27
professionalShameel22-Aug-11 4:27 
Questionwindow services in VS2008 [modified] Pin
Aisha sharma21-Aug-11 21:12
Aisha sharma21-Aug-11 21:12 
AnswerRe: window services in VS2008 Pin
Richard MacCutchan21-Aug-11 21:38
mveRichard MacCutchan21-Aug-11 21:38 
AnswerRe: window services in VS2008 Pin
Paul E Davies21-Aug-11 22:07
Paul E Davies21-Aug-11 22:07 
GeneralRe: window services in VS2008 Pin
Aisha sharma22-Aug-11 0:29
Aisha sharma22-Aug-11 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.