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

C#

 
Questionpublic static property question Pin
uglyeyes7-Oct-06 20:55
uglyeyes7-Oct-06 20:55 
AnswerRe: public static property question Pin
NaNg152417-Oct-06 21:00
NaNg152417-Oct-06 21:00 
AnswerRe: public static property question Pin
Guffa7-Oct-06 21:12
Guffa7-Oct-06 21:12 
GeneralRe: public static property question Pin
Christian Graus8-Oct-06 0:27
protectorChristian Graus8-Oct-06 0:27 
QuestionWireless with C# on WindowsXP ?? Pin
allenmpcx7-Oct-06 20:30
allenmpcx7-Oct-06 20:30 
AnswerRe: Wireless with C# on WindowsXP ?? Pin
yoaz7-Oct-06 22:09
yoaz7-Oct-06 22:09 
QuestionBackgroundWorker ? Pin
Christian Graus7-Oct-06 17:31
protectorChristian Graus7-Oct-06 17:31 
AnswerRe: BackgroundWorker ? Pin
Judah Gabriel Himango7-Oct-06 17:47
sponsorJudah Gabriel Himango7-Oct-06 17:47 
CG, you gotta set the example, man, and use <pre> tags around that code! Smile | :)

Just skimming the code, a couple things jump out at me. First, you're calling Application.DoEvents everywhere. In my experience, this is a bad idea, because you can start getting things like event handlers out of order if the DoEvents is called in certain places.

The lblLoadingCase is a label? If so, don't update that in DoWork. Same goes for the progress bar. The DoWork method is called on a background thread, the ProgressChanged and RunWorkerCompleted will be called from the UI thread. Accessing WinForm controls on a background thread is asking for trouble; VS2005 will actually throw an exception if this happens under the debugger.

As far as the freezing goes, my only guess is the ProgressChanged event is getting hammered; flooded with calls. Each call will require the UI thread to execute it obviously, so the if the UI thread is constantly busy, the UI won't have a chance to paint.

Here's what I recommend: first narrow the problem down, see if it's the ProgressChanged handler, let's see if it becomes responsive again. If it's responsive when you don't call ReportProgress, then you need to update the UI in a manner that allows the UI to still repaint itself. I have such a solution if you're interested; it's actually pretty easy to implement. But first try removing calls to ReportProgress, and see if the app is responsive again, then let me know.

If it's not that, it may be that your DoWork handler is being called on the UI thread, which would indicate you're not starting the work correctly or the worker wasn't initialized on the UI thread.



Tech, life, family, faith: Give me a visit.
I'm currently blogging about: For Christians: The Significance of Yom Teruah
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


GeneralRe: BackgroundWorker ? Pin
Christian Graus7-Oct-06 23:07
protectorChristian Graus7-Oct-06 23:07 
GeneralRe: BackgroundWorker ? Pin
Christian Graus8-Oct-06 0:37
protectorChristian Graus8-Oct-06 0:37 
GeneralRe: BackgroundWorker ? Pin
Judah Gabriel Himango8-Oct-06 8:22
sponsorJudah Gabriel Himango8-Oct-06 8:22 
AnswerRe: BackgroundWorker ? Pin
Robert Rohde7-Oct-06 22:47
Robert Rohde7-Oct-06 22:47 
GeneralRe: BackgroundWorker ? Pin
Christian Graus7-Oct-06 23:09
protectorChristian Graus7-Oct-06 23:09 
QuestionNetwork management with C# .NET? Pin
Asad_N7-Oct-06 17:01
Asad_N7-Oct-06 17:01 
AnswerRe: Network management with C# .NET? Pin
Ray Cassick7-Oct-06 17:09
Ray Cassick7-Oct-06 17:09 
GeneralRe: Network management with C# .NET? Pin
Asad_N7-Oct-06 17:38
Asad_N7-Oct-06 17:38 
AnswerRe: Network management with C# .NET? Pin
yoaz7-Oct-06 22:44
yoaz7-Oct-06 22:44 
AnswerRe: Network management with C# .NET? Pin
spiritboy10-Jul-09 6:59
spiritboy10-Jul-09 6:59 
QuestionEditing a file over FTP Pin
Anthony Mushrow7-Oct-06 15:08
professionalAnthony Mushrow7-Oct-06 15:08 
AnswerRe: Editing a file over FTP Pin
Guffa7-Oct-06 20:39
Guffa7-Oct-06 20:39 
AnswerRe: Editing a file over FTP Pin
Daniel Monzert7-Oct-06 21:27
Daniel Monzert7-Oct-06 21:27 
QuestionUDP/IP sockets Pin
NaNg152417-Oct-06 10:21
NaNg152417-Oct-06 10:21 
QuestionInserting data from datagrid into Sql server Pin
engineer_ali7-Oct-06 7:46
engineer_ali7-Oct-06 7:46 
QuestionHow to print Datagrid in C# 2005 ? Pin
hdv2127-Oct-06 7:37
hdv2127-Oct-06 7:37 
AnswerRe: How to print Datagrid in C# 2005 ? Pin
Nader Elshehabi8-Oct-06 6:47
Nader Elshehabi8-Oct-06 6:47 

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.