Click here to Skip to main content
15,890,717 members
Home / Discussions / C#
   

C#

 
QuestionRe: C# reading multiple files by multiple thread issue Pin
Member 153296131-Nov-21 8:29
Member 153296131-Nov-21 8:29 
AnswerRe: C# reading multiple files by multiple thread issue Pin
Randor 1-Nov-21 15:41
professional Randor 1-Nov-21 15:41 
AnswerRe: C# reading multiple files by multiple thread issue Pin
Gerry Schmitz2-Nov-21 7:53
mveGerry Schmitz2-Nov-21 7:53 
AnswerRe: C# reading multiple files by multiple thread issue Pin
primem0ver4-Nov-21 5:47
primem0ver4-Nov-21 5:47 
QuestionThread Label Updating Pin
Member 1540852926-Oct-21 8:15
Member 1540852926-Oct-21 8:15 
AnswerRe: Thread Label Updating Pin
Gerry Schmitz26-Oct-21 8:36
mveGerry Schmitz26-Oct-21 8:36 
GeneralRe: Thread Label Updating Pin
Member 1540852926-Oct-21 9:17
Member 1540852926-Oct-21 9:17 
AnswerRe: Thread Label Updating Pin
OriginalGriff26-Oct-21 8:59
mveOriginalGriff26-Oct-21 8:59 
Firstly, you shouldn't be calling Application.Run yourself - you should only have the one message loop. I'm not sure what effect that would have, since there can only be one MainWindow object, and that's already in use ... if that worked (which it doesn't) then your thread Abort would either kill the main form and app, or possibly make it impossible to exit the main process properly at all.

Secondly, you can't update a control except from the thread on which it was created - normally the one and only UI thread - so accessing the label on the splash form is going to be problematic - if you could find it, which you can't since the only reference you have is local to the loading method.

The normal way to do this is to Show the Splash screen, and move the long running task to a background thread, which updates the splash screen via progress reports to the UI thread - and I'd move the "loading" code into the Form.Load or Form.Shown event handlers instead of in the main form constructor and use a BackgroundWorker class instance to offload the long job to a second thread, using the Progress reporting of that class to get information back to the UI thread.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Thread Label Updating Pin
Member 1540852926-Oct-21 9:15
Member 1540852926-Oct-21 9:15 
GeneralRe: Thread Label Updating Pin
OriginalGriff26-Oct-21 22:17
mveOriginalGriff26-Oct-21 22:17 
GeneralRe: Thread Label Updating Pin
Gerry Schmitz28-Oct-21 6:43
mveGerry Schmitz28-Oct-21 6:43 
GeneralRe: Thread Label Updating Pin
OriginalGriff28-Oct-21 20:17
mveOriginalGriff28-Oct-21 20:17 
AnswerRe: Thread Label Updating Pin
BillWoodruff26-Oct-21 16:55
professionalBillWoodruff26-Oct-21 16:55 
Question.NET with problems Pin
Ismael Oliveira 202123-Oct-21 9:48
Ismael Oliveira 202123-Oct-21 9:48 
AnswerRe: .NET with problems Pin
Dave Kreskowiak23-Oct-21 12:15
mveDave Kreskowiak23-Oct-21 12:15 
AnswerRe: .NET with problems Pin
Gerry Schmitz23-Oct-21 16:00
mveGerry Schmitz23-Oct-21 16:00 
AnswerRe: .NET with problems Pin
BillWoodruff23-Oct-21 21:04
professionalBillWoodruff23-Oct-21 21:04 
AnswerRe: .NET with problems Pin
Matthew Dennis26-Oct-21 8:52
sysadminMatthew Dennis26-Oct-21 8:52 
QuestionC# Virtual Camera Pin
Software and Sowftware21-Oct-21 23:32
Software and Sowftware21-Oct-21 23:32 
AnswerRe: C# Virtual Camera Pin
lmoelleb22-Oct-21 2:30
lmoelleb22-Oct-21 2:30 
AnswerRe: C# Virtual Camera Pin
Gerry Schmitz22-Oct-21 7:37
mveGerry Schmitz22-Oct-21 7:37 
QuestionC# & .Net core new features related articles Pin
Mou_kol19-Oct-21 8:14
Mou_kol19-Oct-21 8:14 
AnswerRe: C# & .Net core new features related articles Pin
Richard Andrew x6419-Oct-21 10:48
professionalRichard Andrew x6419-Oct-21 10:48 
AnswerRe: C# & .Net core new features related articles Pin
BillWoodruff20-Oct-21 23:18
professionalBillWoodruff20-Oct-21 23:18 
QuestionSend Whatsapp Messages from C# Windows Forms Application Pin
Zeyad Jalil18-Oct-21 1:13
professionalZeyad Jalil18-Oct-21 1:13 

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.