Click here to Skip to main content
15,893,998 members
Home / Discussions / C#
   

C#

 
GeneralRe: LINQ (C# 3.0) Pin
Judah Gabriel Himango25-Oct-06 17:06
sponsorJudah Gabriel Himango25-Oct-06 17:06 
QuestionExcel and Windows Services Pin
gantww25-Oct-06 4:50
gantww25-Oct-06 4:50 
AnswerRe: Excel and Windows Services Pin
seee sharp25-Oct-06 21:48
seee sharp25-Oct-06 21:48 
Questionhow to change values of Crystal Reports in vc# 2005? Pin
hdv21225-Oct-06 4:42
hdv21225-Oct-06 4:42 
AnswerRe: how to change values of Crystal Reports in vc# 2005? Pin
bearfx25-Oct-06 8:28
bearfx25-Oct-06 8:28 
QuestionFooter in Datagridview Pin
hekim1325-Oct-06 4:29
hekim1325-Oct-06 4:29 
AnswerRe: Footer in Datagridview Pin
sam#25-Oct-06 7:58
sam#25-Oct-06 7:58 
QuestionProper way to handle single instance application and multithreading Pin
Dan Neely25-Oct-06 3:47
Dan Neely25-Oct-06 3:47 
I have an app that currently creates several worker threads in the mainform constructor. I'm currently modifying it to only allow one running copy at a time. The issue I have is that since the threads are created in the constructor prior to starting the app, when the already running check is done and the main thread isn't started they're orphaned and the 2nd instance remains hiding in the process list.

I've found two possible workarounds for this. The first is to move the thread creation from the form constructor to the OnLoad event, so that they're never created on the aborted 2nd instance attempt. The second is to explicitly create the form on the Main method and then do an explicit dispose, after the run call.

MyFormClass theForm = new MyFormClass();
SingleApplication.Run(theForm);
theForm.Dispose();


Is there any design reason to prefer one over the other?


http://www.codeproject.com/csharp/singleinstance.asp
AnswerRe: Proper way to handle single instance application and multithreading Pin
ejuanpp25-Oct-06 4:23
ejuanpp25-Oct-06 4:23 
GeneralRe: Proper way to handle single instance application and multithreading Pin
Dan Neely25-Oct-06 4:56
Dan Neely25-Oct-06 4:56 
QuestionJust want to init a member of a struct Pin
qingyingqy25-Oct-06 2:34
qingyingqy25-Oct-06 2:34 
AnswerRe: Just want to init a member of a struct Pin
User 665825-Oct-06 3:13
User 665825-Oct-06 3:13 
AnswerRe: Just want to init a member of a struct Pin
Guffa25-Oct-06 3:15
Guffa25-Oct-06 3:15 
QuestionComboBox and DataSource attribute Pin
zaboboa25-Oct-06 2:33
zaboboa25-Oct-06 2:33 
AnswerRe: ComboBox and DataSource attribute Pin
sam#25-Oct-06 7:47
sam#25-Oct-06 7:47 
QuestionDisable Ambient properties from being set Pin
chricla25-Oct-06 2:23
chricla25-Oct-06 2:23 
AnswerRe: Disable Ambient properties from being set Pin
sam#25-Oct-06 8:04
sam#25-Oct-06 8:04 
QuestionApplication hang-up in .net 2.0 windows forms Pin
pranu_1325-Oct-06 1:11
pranu_1325-Oct-06 1:11 
AnswerRe: Application hang-up in .net 2.0 windows forms Pin
Judah Gabriel Himango25-Oct-06 5:10
sponsorJudah Gabriel Himango25-Oct-06 5:10 
QuestionNeed to access string from HTMLRequest Pin
jarlath25-Oct-06 1:08
jarlath25-Oct-06 1:08 
AnswerRe: Need to access string from HTMLRequest Pin
J. Dunlap25-Oct-06 1:44
J. Dunlap25-Oct-06 1:44 
GeneralRe: Need to access string from HTMLRequest Pin
jarlath25-Oct-06 4:58
jarlath25-Oct-06 4:58 
GeneralRe: Need to access string from HTMLRequest Pin
Elina Blank25-Oct-06 6:23
sitebuilderElina Blank25-Oct-06 6:23 
Questionabout tokens Pin
keluo25-Oct-06 0:55
keluo25-Oct-06 0:55 
AnswerRe: about tokens Pin
Judah Gabriel Himango25-Oct-06 5:11
sponsorJudah Gabriel Himango25-Oct-06 5:11 

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.