Click here to Skip to main content
15,907,905 members
Home / Discussions / C#
   

C#

 
GeneralRe: Run Multiple Forms Pin
Shameel22-Aug-11 4:03
professionalShameel22-Aug-11 4:03 
GeneralRe: Run Multiple Forms Pin
BillWoodruff22-Aug-11 20:35
professionalBillWoodruff22-Aug-11 20:35 
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 
Your scenario I find a little ambiguous: you write, on the one hand, about connection threads on the same WinForm, but, then you write of having multiple Forms: can you clarify that a bit ?

In any case you don't want to be calling Application.Run more than once.

If you are describing a scenario in which there isn't the typical pattern of a single new instance of some Form passed as the argument to Application.Run(new MainForm), and you 'Show a bunch of forms before calling Application.Run():

If that is your goal, there's nothing wrong with that: but you then need to consider the implications of that strategy:

1. there's no single Form which, when closed, will close all the other open Forms and exit the Application: you could possibly, by closing all open Forms, leave the Application running without you having any way to access it, or terminate it.

An easy work-around for the problem of closing the Application in this scenario is to write a handler for each Form's 'Closing' event, check and see if the collection of open forms in Application.OpenForms.Count == 1, and if that's the case, do an Application.Exit().

A question: what reason do you have for not creating other forms inside a MainForm launched in the usual way ?

best, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
modified on Tuesday, August 23, 2011 2:38 AM

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 
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 Pin
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 

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.