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

C#

 
GeneralRe: Learning Datasets... Pin
PIEBALDconsult15-Aug-10 16:58
mvePIEBALDconsult15-Aug-10 16:58 
QuestionTargetInvocationException? Pin
Megidolaon15-Aug-10 8:13
Megidolaon15-Aug-10 8:13 
AnswerRe: TargetInvocationException? Pin
OriginalGriff15-Aug-10 8:26
mveOriginalGriff15-Aug-10 8:26 
GeneralRe: TargetInvocationException? Pin
Megidolaon16-Aug-10 3:29
Megidolaon16-Aug-10 3:29 
GeneralRe: TargetInvocationException? Pin
Alan N16-Aug-10 6:14
Alan N16-Aug-10 6:14 
GeneralRe: TargetInvocationException? [modified] Pin
Megidolaon16-Aug-10 15:40
Megidolaon16-Aug-10 15:40 
AnswerRe: TargetInvocationException? Pin
PIEBALDconsult15-Aug-10 8:28
mvePIEBALDconsult15-Aug-10 8:28 
AnswerRe: TargetInvocationException? Pin
Luc Pattyn15-Aug-10 8:41
sitebuilderLuc Pattyn15-Aug-10 8:41 
Three remarks FYI:

1.
there is ProgressChangedEventArgs.ProgressPercentage which is of type int; its name suggests the value should be in the range [0,100] however the value is irrelevant to .NET and you can pass any value you choose, from int.MinValue to int.MaxValue, so you have a full 32-bit resolution at your disposal.

2.
I don't expect people be interested in a very accurate progress value; if you were to display a progress bar on a display with say 1280 pixels, then you would be able to show no more than 1281 different values anyway; yes you could just show a number, but that does seem a bit awkward.

3.
Once you have settled on the exact range and resolution you want to pass around, you should make sure not to call ReportProgress() with the same progress value over and over, as each call causes a thread switch, and achieves nothing as no new information is passed anyway. So create a little method and compare with the previous value, as in:

public void MyReportProgress(int val) {
    if (val!=previousVal) {
        previousVal=val;
        ReportProgress(val);
    }
}


You may be surprised how much faster your actual operation runs once you stop passing unnecessary progress resolution back and forth (and stop repainting that progress bar abundantly).

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


modified on Sunday, August 15, 2010 2:47 PM

Question[Solved] UdpClient callback question [modified] Pin
AtomTech15-Aug-10 4:59
AtomTech15-Aug-10 4:59 
AnswerRe: UdpClient callback question Pin
Gary R. Wheeler15-Aug-10 5:22
Gary R. Wheeler15-Aug-10 5:22 
AnswerRe: [Solved] UdpClient callback question Pin
Luc Pattyn15-Aug-10 7:08
sitebuilderLuc Pattyn15-Aug-10 7:08 
GeneralRe: [Solved] UdpClient callback question Pin
Dan Mos15-Aug-10 7:19
Dan Mos15-Aug-10 7:19 
GeneralRe: [Solved] UdpClient callback question Pin
Luc Pattyn15-Aug-10 7:40
sitebuilderLuc Pattyn15-Aug-10 7:40 
QuestionProcess and memory Pin
keloth8715-Aug-10 4:12
keloth8715-Aug-10 4:12 
AnswerRe: Process and memory Pin
Gary R. Wheeler15-Aug-10 5:29
Gary R. Wheeler15-Aug-10 5:29 
AnswerRe: Process and memory Pin
Luc Pattyn15-Aug-10 7:16
sitebuilderLuc Pattyn15-Aug-10 7:16 
QuestionReading data from HTTP Pin
Wamuti15-Aug-10 3:48
Wamuti15-Aug-10 3:48 
AnswerRe: Reading data from HTTP Pin
Nicholas Butler15-Aug-10 4:14
sitebuilderNicholas Butler15-Aug-10 4:14 
AnswerRe: Reading data from HTTP Pin
Not Active15-Aug-10 4:15
mentorNot Active15-Aug-10 4:15 
QuestionHow to customise the behaviour of a control when it is selected Pin
Dave Midgley15-Aug-10 2:54
Dave Midgley15-Aug-10 2:54 
QuestionLinq - Join Pin
treuveni15-Aug-10 2:50
treuveni15-Aug-10 2:50 
AnswerRe: Linq - Join Pin
Dan Mos15-Aug-10 3:30
Dan Mos15-Aug-10 3:30 
GeneralRe: Linq - Join Pin
treuveni15-Aug-10 4:17
treuveni15-Aug-10 4:17 
GeneralRe: Linq - Join Pin
Dan Mos15-Aug-10 4:30
Dan Mos15-Aug-10 4:30 
GeneralRe: Linq - Join Pin
treuveni18-Aug-10 5:52
treuveni18-Aug-10 5:52 

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.