Click here to Skip to main content
15,918,041 members
Home / Discussions / C#
   

C#

 
AnswerRe: Kernelbase error on Server 2008 Pin
Paw Jershauge13-Apr-10 10:45
Paw Jershauge13-Apr-10 10:45 
AnswerRe: Kernelbase error on Server 2008 Pin
mitch_olgren30-Jul-10 5:20
mitch_olgren30-Jul-10 5:20 
GeneralRe: Kernelbase error on Server 2008 Pin
Paladin200030-Jul-10 6:04
Paladin200030-Jul-10 6:04 
QuestionDoes anyone encountered problems with using of multiple TCP channels in .NET remoting app? [modified] Pin
Slava_K13-Apr-10 8:28
Slava_K13-Apr-10 8:28 
AnswerRe: Does anyone encountered problems with using of multiple TCP channels in .NET remoting app? Pin
thugthug15-Apr-10 5:17
thugthug15-Apr-10 5:17 
QuestionNPlot - how do I not show weekend dates Pin
boreland13-Apr-10 7:36
boreland13-Apr-10 7:36 
QuestionBackground Worker with Multiple Progress Bars Pin
eddieangel13-Apr-10 7:07
eddieangel13-Apr-10 7:07 
AnswerRe: Background Worker with Multiple Progress Bars Pin
Luc Pattyn13-Apr-10 7:23
sitebuilderLuc Pattyn13-Apr-10 7:23 
Hi EA,

1.
BackgroundWorker.ReportProgress() takes either an int, or an int and an object of your choice.

So you could pass two ints to the ProgressChanged event, where the second one would get boxed.
Or you could create a class or struct holding whatever you want to pass, and just pass that.
Or you could use one or more class members.
The only thing you must keep in mind is two threads are active here: the BGW making progress, and the GUI thread displaying progress; so you must avoid inconsistent progress data; not by using locks, but in some other way, e.g. by using value types.

An alternative would be this:
pass the progress within a file as the int, and pass the filename as the object;
let the display routine figure out the overall progress, which can be organized to require only a very simple addition and division.

2.
if the file sizes don't change (much), I would consider storing them in the table; getting them from the file system may be too expensive, depends on how many and how far off (network drive, FTP site, ...).

3.
Warning: don't update progress for every tiny amount of data handled, since that might end up slowing it all down. Updating more than say 20 times per second really makes no sense, the human eye won't follow.
Occasionally I update progress by polling rather than pushing it out: just have a timer (a System.Windows.Forms.Timer is the best fit) cause the display to be updated periodically.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.


GeneralRe: Background Worker with Multiple Progress Bars Pin
eddieangel13-Apr-10 8:47
eddieangel13-Apr-10 8:47 
GeneralRe: Background Worker with Multiple Progress Bars Pin
Luc Pattyn13-Apr-10 9:55
sitebuilderLuc Pattyn13-Apr-10 9:55 
GeneralRe: Background Worker with Multiple Progress Bars Pin
eddieangel13-Apr-10 13:46
eddieangel13-Apr-10 13:46 
QuestionPassing different variable types Pin
mprice21413-Apr-10 4:51
mprice21413-Apr-10 4:51 
AnswerRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 5:54
sitebuilderLuc Pattyn13-Apr-10 5:54 
GeneralRe: Passing different variable types Pin
dan!sh 13-Apr-10 6:12
professional dan!sh 13-Apr-10 6:12 
GeneralRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 6:28
sitebuilderLuc Pattyn13-Apr-10 6:28 
GeneralRe: Passing different variable types Pin
dan!sh 13-Apr-10 6:46
professional dan!sh 13-Apr-10 6:46 
GeneralRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 6:47
sitebuilderLuc Pattyn13-Apr-10 6:47 
GeneralRe: Passing different variable types Pin
DaveyM6913-Apr-10 8:25
professionalDaveyM6913-Apr-10 8:25 
GeneralRe: Passing different variable types Pin
mprice21413-Apr-10 6:30
mprice21413-Apr-10 6:30 
GeneralRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 6:46
sitebuilderLuc Pattyn13-Apr-10 6:46 
GeneralRe: Passing different variable types Pin
mprice21413-Apr-10 7:56
mprice21413-Apr-10 7:56 
GeneralRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 8:02
sitebuilderLuc Pattyn13-Apr-10 8:02 
AnswerRe: Passing different variable types Pin
kevinnicol13-Apr-10 6:19
kevinnicol13-Apr-10 6:19 
GeneralRe: Passing different variable types Pin
mprice21413-Apr-10 6:32
mprice21413-Apr-10 6:32 
QuestionHow to Save the Excel file with some file format [modified] [Solved] Pin
yu-jian13-Apr-10 4:37
yu-jian13-Apr-10 4:37 

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.