Click here to Skip to main content
15,926,507 members
Home / Discussions / C#
   

C#

 
QuestionManualResetEvent troubles Pin
Judah Gabriel Himango22-May-06 5:59
sponsorJudah Gabriel Himango22-May-06 5:59 
AnswerRe: ManualResetEvent troubles Pin
leppie22-May-06 6:33
leppie22-May-06 6:33 
GeneralRe: ManualResetEvent troubles Pin
Judah Gabriel Himango22-May-06 7:15
sponsorJudah Gabriel Himango22-May-06 7:15 
GeneralRe: ManualResetEvent troubles Pin
leppie22-May-06 7:34
leppie22-May-06 7:34 
GeneralRe: ManualResetEvent troubles Pin
Judah Gabriel Himango22-May-06 7:38
sponsorJudah Gabriel Himango22-May-06 7:38 
GeneralRe: ManualResetEvent troubles Pin
Judah Gabriel Himango22-May-06 9:21
sponsorJudah Gabriel Himango22-May-06 9:21 
QuestionThreads, Events & BeginInvoke Pin
iswoolley22-May-06 5:11
iswoolley22-May-06 5:11 
AnswerRe: Threads, Events & BeginInvoke [modified] Pin
Dustin Metzgar22-May-06 6:06
Dustin Metzgar22-May-06 6:06 
First of all, you can update your progress bar from a worker thread. Second of all, an event is not thrown when you do a ++ on progress.

Change your property to something like this:

public int Progress {
   get { return progress; }
   set {
      progress = value;
      if (ProgressChanged != null)
         ProgressChanged(this, new EventArgs());
   }
}


Then you could write a Progress++ in your code and the event will fire.

But what you're really trying to do is tell your progress bar to increment. What I do for this is add this delegate to my form class:

delegate void ProgressBarStep();

Then I have a method that's called by my worker thread:

private void WorkerThreadMethod()
{
   ...
   ProgressBarStep progBarStep = delegate() { progressBar.PerformStep(); };
   ...
   Invoke(progBarStep);
   ...
}

Notice that I use an anonymous method and call Invoke on the form itself. This will let you call methods on the main thread from another thread. Use the invoke inside your loop.

Hope that makes sense.

www.logifusion.com

-- modified at 12:06 Monday 22nd May, 2006
GeneralRe: Threads, Events & BeginInvoke [modified] Pin
Iain W22-May-06 9:49
Iain W22-May-06 9:49 
AnswerRe: Threads, Events & BeginInvoke Pin
Judah Gabriel Himango22-May-06 6:13
sponsorJudah Gabriel Himango22-May-06 6:13 
GeneralRe: Threads, Events & BeginInvoke Pin
Iain W22-May-06 9:58
Iain W22-May-06 9:58 
GeneralRe: Threads, Events & BeginInvoke Pin
Judah Gabriel Himango22-May-06 10:16
sponsorJudah Gabriel Himango22-May-06 10:16 
QuestionNeed help Pin
engsrini22-May-06 4:56
engsrini22-May-06 4:56 
AnswerRe: Need help Pin
Judah Gabriel Himango22-May-06 6:16
sponsorJudah Gabriel Himango22-May-06 6:16 
GeneralRe: Need help Pin
engsrini22-May-06 6:37
engsrini22-May-06 6:37 
QuestionType or namespace name could not be found Pin
msolh22-May-06 4:17
msolh22-May-06 4:17 
AnswerRe: Type or namespace name could not be found Pin
User 665822-May-06 5:11
User 665822-May-06 5:11 
GeneralRe: Type or namespace name could not be found Pin
msolh22-May-06 7:57
msolh22-May-06 7:57 
GeneralRe: Type or namespace name could not be found Pin
User 665822-May-06 11:16
User 665822-May-06 11:16 
QuestionDatabinding Listview with array reference Pin
Seraphin22-May-06 3:54
Seraphin22-May-06 3:54 
Questiona question about tabcontrol ? Pin
cmpeng3422-May-06 3:47
cmpeng3422-May-06 3:47 
AnswerRe: a question about tabcontrol ? Pin
KishoreT22-May-06 3:53
KishoreT22-May-06 3:53 
AnswerRe: a question about tabcontrol ? Pin
sathish s22-May-06 4:00
sathish s22-May-06 4:00 
GeneralRe: a question about tabcontrol ? Pin
RaviBattula22-May-06 4:19
professionalRaviBattula22-May-06 4:19 
Questioncompile C# windows project using csc Pin
KishoreT22-May-06 3:46
KishoreT22-May-06 3:46 

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.