473,473 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Backgroundworker show progress

Hi,

I use a backgroundworker to get the total size of a homeshare (as it
is a bit time-consuming). Wat i would like to do, is show the
progress, but at start i don't know how much files/folders will come
up, so i dont't know how to feed the progressbar (i believe i need to
know the maximum # of files to get a representative progress bar?).

Anyone has any ideas?

Kind regards,

Mario
The Netherlands

Jun 28 '07 #1
2 2952
On Thu, 28 Jun 2007 12:16:55 -0700, <mc*********@interpolis.nlwrote:
I use a backgroundworker to get the total size of a homeshare (as it
is a bit time-consuming). Wat i would like to do, is show the
progress, but at start i don't know how much files/folders will come
up, so i dont't know how to feed the progressbar (i believe i need to
know the maximum # of files to get a representative progress bar?).
To show the user an accurate percentage completion, you need to know the
total amount of work. There's no way around that.

I don't know what it means to "get the total size of a homeshare" (what's
a "homeshare"?), but if that involves traversing a directory structure and
adding up file sizes or something like that, then yes...you can't
accurately determine the total amount of work without doing the whole
traversal. At which point you could have simply finished the work already.

That said, you can do some things to "fake it". One is to abandon the
idea of showing progress per se. Just show some indication of activity so
that the user knows you're doing _something_. Another option is to do a
quick preliminary traversal, enumerating the first one or two directory
levels, and then base your progress on that. The relative progress could
still wind up skewed if there is a huge difference in the work for each
directory near the top level, but it's about the best you can do in this
situation. In most cases, it would provide pretty good feedback to the
user.

Pete
Jun 28 '07 #2
That said, you can do some things to "fake it". One is to abandon the
idea of showingprogressper se. Just show some indication of activity so
that the user knows you're doing _something_.
Pete, thanks for your response. I decided to show an animated gif of a
progressbar during the time the backgroundworker is active, so users
will see some activity.

Greetings,

Mario

Jun 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dm1608 | last post by:
Hi -- I have a C# application that basically has a button that executes a SQL Reader to loop thru a rather large resul set. Thru each interation of the reader object, I check to see if a file...
5
by: Rob R. Ainscough | last post by:
I'm using a BackgroundWorker to perform a file download from an ftp site. Per good code design practices where I separate my UI code from my core logic code (in this case my Download file method in...
1
by: Bob | last post by:
Hi, I am having trouble seeing how this bolts together. The UI starts a process which involves a long running database update. All Database activity is handled by a class called DT. DT has a...
3
by: ray.ackley | last post by:
Hello all, I have an app that uses a BackgroundWorker() object to read USB data that is being fed in serially (FT245R chip, www.ftdichip.com). It looks just like a serial data stream. Anyhow,...
14
by: =?Utf-8?B?SXNobWFlbA==?= | last post by:
Hi, I have a form with a progress bar on it and wanted to use the BackgroundWorker to be able to update the progress. I looked at examples, run some of them, but in debug, when the code gets to...
0
by: Chris | last post by:
I would like to be able to pass the BackgroundWorker object and DoWork Event Args to a second function (third function?) and be able to still report the progress. I'm getting the following...
7
by: =?Utf-8?B?SGVucnk5OQ==?= | last post by:
What happens here? The backgroundworker (bgw) unzips RTF-Helpfiles (up to 1 MB in size). The ProgressChanged-Event gets the unzipped files (to display them in a RichtTextBox) It follows the...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
4
by: Sin Jeong-hun | last post by:
This is what I've always been wondered. Suppose I've created a class named Agent, and the Agent does some lengthy job. Of course I don't want to block the main window, so the Agent does the job in...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.