Click here to Skip to main content
15,900,378 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threading Pin
HexaDeveloper29-Mar-07 9:50
HexaDeveloper29-Mar-07 9:50 
GeneralRe: Threading Pin
Member 9629-Mar-07 10:01
Member 9629-Mar-07 10:01 
GeneralRe: Threading Pin
HexaDeveloper29-Mar-07 11:12
HexaDeveloper29-Mar-07 11:12 
GeneralRe: Threading Pin
Member 9629-Mar-07 11:28
Member 9629-Mar-07 11:28 
GeneralRe: Threading Pin
HexaDeveloper30-Mar-07 9:57
HexaDeveloper30-Mar-07 9:57 
GeneralRe: Threading Pin
Member 9630-Mar-07 10:54
Member 9630-Mar-07 10:54 
GeneralRe: Threading Pin
HexaDeveloper1-Apr-07 2:36
HexaDeveloper1-Apr-07 2:36 
GeneralRe: Threading Pin
Member 961-Apr-07 6:35
Member 961-Apr-07 6:35 
1) You don't have to use this with a progressbar, even if it's just a spinner cursor or a text box that get's updated but *somehow* you are reporting to the end user that something is still happening right? In one app I use a progress bar, but I also use a text box to report the stage of a multi stage operation and in the backgroundworkder ReportProgress method I put the string of text describing the state in the UserState object parameter. Then in my UI's progresschanged event I both update the progressbar and the text box with the UserState string.


Why do you need to call invalidate, you can just update whatever UI objects you are using to report progress in the reportprogress event. I can't think of any reason to call Invalidate.

If you don't want to report anything to the user and are just using the backgroundworkder to spawn a thread to do something behind the scenes there is no need to call reportprogress or handle the progresschanged event (though it's still useful in a non UI situation in case you want to detect if it's stalled for some reason even just in code)

2) I've never found a need to call Dispose on the backgroundworker object so I can't speak to that but the error seems to indicate, you are calling it too early.

A lot of what you seem to be having problems with sounds like it stems from your earlier attempts to manually create threads and doesn't apply to the backgroundworker method at all. It seems like you are overthinking this and putting too much extra code in that you don't actually need. Without knowing the exact details I can't say for sure, but that's what it sounds like.
GeneralRe: Threading Pin
HexaDeveloper1-Apr-07 8:27
HexaDeveloper1-Apr-07 8:27 
GeneralRe: Threading Pin
Member 961-Apr-07 9:50
Member 961-Apr-07 9:50 
GeneralRe: Threading Pin
HexaDeveloper1-Apr-07 12:06
HexaDeveloper1-Apr-07 12:06 
GeneralRe: Threading Pin
Member 961-Apr-07 12:11
Member 961-Apr-07 12:11 
Questioncahanging behaviour of button control Pin
t4ure4n29-Mar-07 4:26
t4ure4n29-Mar-07 4:26 
AnswerRe: cahanging behaviour of button control Pin
Bekjong29-Mar-07 5:13
Bekjong29-Mar-07 5:13 
QuestionMaskedTextBox Pin
msogun29-Mar-07 4:26
msogun29-Mar-07 4:26 
QuestionUsing findIndex and predicate Pin
sinosoidal29-Mar-07 4:20
sinosoidal29-Mar-07 4:20 
QuestionKeyboard listening Pin
Saikek29-Mar-07 4:11
Saikek29-Mar-07 4:11 
GeneralRe: Keyboard listening Pin
Martin#29-Mar-07 4:56
Martin#29-Mar-07 4:56 
GeneralRe: Keyboard listening Pin
Saikek29-Mar-07 6:47
Saikek29-Mar-07 6:47 
Question.Net 1.1 on Windows NT Pin
satsumatable29-Mar-07 4:09
satsumatable29-Mar-07 4:09 
QuestionHelp required in dropdownlist Pin
kathiksourcecode29-Mar-07 3:11
kathiksourcecode29-Mar-07 3:11 
AnswerRe: Help required in dropdownlist Pin
Not Active29-Mar-07 4:04
mentorNot Active29-Mar-07 4:04 
QuestionRetrieve values into datagrid from database Pin
yaminilatha29-Mar-07 2:17
yaminilatha29-Mar-07 2:17 
AnswerRe: Retrieve values into datagrid from database Pin
Not Active29-Mar-07 4:33
mentorNot Active29-Mar-07 4:33 
QuestionSmart Custom Control Pin
Monty229-Mar-07 2:12
Monty229-Mar-07 2:12 

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.