Click here to Skip to main content
15,909,896 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionWhy does "DoEvents()" reset Current.Cursor? Pin
Noodnik24-Nov-03 10:21
Noodnik24-Nov-03 10:21 
GeneralDataSet -> SoapSerializationData Pin
ODS24-Nov-03 6:12
ODS24-Nov-03 6:12 
GeneralModifying SOAP client request Pin
Anonymous24-Nov-03 5:50
Anonymous24-Nov-03 5:50 
QuestionUpdate dotNET framework ? Pin
thaivs1118123-Nov-03 21:25
thaivs1118123-Nov-03 21:25 
AnswerRe: Update dotNET framework ? Pin
Paul Watson24-Nov-03 5:55
sitebuilderPaul Watson24-Nov-03 5:55 
AnswerRe: Update dotNET framework ? Pin
Matt Philmon4-Dec-03 7:38
Matt Philmon4-Dec-03 7:38 
GeneralVB.Net Pin
MonsterHilux23-Nov-03 19:56
MonsterHilux23-Nov-03 19:56 
GeneralRe: VB.Net Pin
Colin Angus Mackay26-Nov-03 12:57
Colin Angus Mackay26-Nov-03 12:57 
Your program will have a Main method for the application, this will be a static member of the form the application starts with.

From MSDN:
Typically, the main function of an application calls this method and passes to it the main window of the application.

This method adds an event handler to the mainForm parameter for the Closed event. The event handler calls ExitThread to clean up the application.

Note The Dispose method of the Form class will be called prior to the return of this method.


So... When your main form closes, so does the application.

The trick is then keeping the application running.

My suggestion is to set up an event handler to catch the Closing[^] event on the Form and set the Cancel property of the CancelEventArgs[^] passed to your handler to true. i.e. e.Cancel = true

Of course, this means that your form is still open (you cancelled the close operation) so you could make the whole thing invisible by setting visible=false on the form.

You would still have to close it properly to exit the application. (Back to your closing event handler - An if (Visible == true) {} else {} would be needed.

Alternatively - if the above is too messy: If the second form always opens after the first is closed then you could pass the appliction control to the second window. That is your Main() method would contain:
Application.Run(new FirstForm());
Application.Run(new SecondForm());


I've never tried this approach - So I don't know if it would really work - but it's worth a try. Besides, it is a lot neater than my first solution.

--Colin Mackay--

"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)


QuestionHow to fake services on .NET hosts ? Pin
Jerry Evans21-Nov-03 9:23
Jerry Evans21-Nov-03 9:23 
AnswerRe: How to fake services on .NET hosts ? Pin
Daniel Turini21-Nov-03 10:03
Daniel Turini21-Nov-03 10:03 
GeneralHelp!! About VScrollBar control in .NET Framework Pin
newhzh21-Nov-03 0:14
newhzh21-Nov-03 0:14 
QuestionCould anybody tell me the parameter of CryptUIDlgSelectCertificate API of cryptui.dll? Pin
zhang_hao20-Nov-03 18:03
zhang_hao20-Nov-03 18:03 
GeneralProble while sending mail through windows service using MSMAPI Pin
alexander13219-Nov-03 20:32
alexander13219-Nov-03 20:32 
GeneralPictureBox StretchImage problem Pin
Msftone19-Nov-03 13:53
Msftone19-Nov-03 13:53 
QuestionWhat about pipes? Pin
Noodnik19-Nov-03 11:39
Noodnik19-Nov-03 11:39 
AnswerRe: What about pipes? Pin
Jeff Varszegi19-Nov-03 11:50
professionalJeff Varszegi19-Nov-03 11:50 
GeneralRe: What about pipes? Pin
Noodnik19-Nov-03 17:59
Noodnik19-Nov-03 17:59 
General.NET on Terminal Server Pin
O c t a v i e19-Nov-03 3:35
O c t a v i e19-Nov-03 3:35 
GeneralRe: .NET on Terminal Server Pin
Pauwll23-Nov-03 0:28
Pauwll23-Nov-03 0:28 
GeneralRe: .NET on Terminal Server SOLVED! Pin
O c t a v i e23-Nov-03 23:52
O c t a v i e23-Nov-03 23:52 
GeneralDatabase communication Pin
Moonspellwizard17-Nov-03 23:31
Moonspellwizard17-Nov-03 23:31 
GeneralRe: Database communication Pin
Colin Angus Mackay18-Nov-03 0:14
Colin Angus Mackay18-Nov-03 0:14 
General5 Steps to Rapid Development Pin
smars17-Nov-03 23:01
smars17-Nov-03 23:01 
QuestionHow to compare Word files Pin
Ali-imran15-Nov-03 2:24
Ali-imran15-Nov-03 2:24 
AnswerRe: How to compare Word files Pin
Nick Parker16-Nov-03 9:51
protectorNick Parker16-Nov-03 9:51 

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.