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

C#

 
Questionuninstall custom action Pin
lune122-Sep-08 4:28
lune122-Sep-08 4:28 
AnswerRe: uninstall custom action Pin
Bassam Saoud2-Sep-08 4:32
Bassam Saoud2-Sep-08 4:32 
GeneralRe: uninstall custom action Pin
lune122-Sep-08 4:39
lune122-Sep-08 4:39 
AnswerRe: uninstall custom action Pin
Jimmanuel2-Sep-08 5:05
Jimmanuel2-Sep-08 5:05 
QuestionCannot focus treeNode in a panel Pin
Kim06182-Sep-08 4:14
Kim06182-Sep-08 4:14 
AnswerRe: Cannot focus treeNode in a panel Pin
leppie2-Sep-08 4:23
leppie2-Sep-08 4:23 
GeneralRe: Cannot focus treeNode in a panel Pin
Kim06182-Sep-08 16:06
Kim06182-Sep-08 16:06 
QuestionProgressBar in multi-threaded application Pin
Lutosław2-Sep-08 4:03
Lutosław2-Sep-08 4:03 
How to report a calculations' progress using a ProgressBar in a WinForms multi-threaded application? I want to utilize CPUs as much as I can and so use all (four) cores. After some googling the only thing I found is a suggestion to use a BackgroudWorker, but it supports only one thread for the same work.
The code looks like this:
Parallel.For(0, width, delegate(int x)
{
//for (int x = 0; x < width; x++)
//{
//calculations with two more nested loops.
(***)
    //}
});

At (***) I tried the following:
1.)
progress.Value = x;

This thrown an exception of course.
2.)
progress.BeginInvoke(new Action (delegate {
            progress.Value = x;
        }));

Here the ProgressBar was updated after all calculation were finished. Tried to set a number of threads to 3 but it didn't change anything.
The implemetation of the Parallel class is robust imho.

Any help appreciated.

Greetings - Gajatko

Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

AnswerRe: ProgressBar in multi-threaded application Pin
TheFM2342-Sep-08 4:18
TheFM2342-Sep-08 4:18 
AnswerRe: ProgressBar in multi-threaded application Pin
leppie2-Sep-08 4:24
leppie2-Sep-08 4:24 
GeneralRe: ProgressBar in multi-threaded application Pin
Lutosław2-Sep-08 6:12
Lutosław2-Sep-08 6:12 
AnswerRe: ProgressBar in multi-threaded application Pin
#realJSOP2-Sep-08 5:05
mve#realJSOP2-Sep-08 5:05 
GeneralRe: ProgressBar in multi-threaded application Pin
Lutosław2-Sep-08 6:09
Lutosław2-Sep-08 6:09 
GeneralRe: ProgressBar in multi-threaded application Pin
#realJSOP2-Sep-08 7:43
mve#realJSOP2-Sep-08 7:43 
GeneralRe: ProgressBar in multi-threaded application Pin
Mark Salsbery2-Sep-08 7:56
Mark Salsbery2-Sep-08 7:56 
GeneralRe: ProgressBar in multi-threaded application Pin
Lutosław2-Sep-08 9:09
Lutosław2-Sep-08 9:09 
GeneralRe: ProgressBar in multi-threaded application Pin
#realJSOP2-Sep-08 9:58
mve#realJSOP2-Sep-08 9:58 
AnswerRe: ProgressBar in multi-threaded application Pin
Daniel Grunwald2-Sep-08 6:22
Daniel Grunwald2-Sep-08 6:22 
GeneralRe: ProgressBar in multi-threaded application Pin
Lutosław2-Sep-08 6:29
Lutosław2-Sep-08 6:29 
GeneralRe: ProgressBar in multi-threaded application Pin
Lutosław2-Sep-08 9:33
Lutosław2-Sep-08 9:33 
GeneralRe: ProgressBar in multi-threaded application Pin
Daniel Grunwald2-Sep-08 9:38
Daniel Grunwald2-Sep-08 9:38 
QuestionID Pin
ellllllllie2-Sep-08 3:07
ellllllllie2-Sep-08 3:07 
AnswerRe: ID Pin
Manas Bhardwaj2-Sep-08 3:36
professionalManas Bhardwaj2-Sep-08 3:36 
GeneralRe: ID Pin
leppie2-Sep-08 3:45
leppie2-Sep-08 3:45 
AnswerRe: ID Pin
leppie2-Sep-08 3:43
leppie2-Sep-08 3:43 

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.