473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Backgroundworker for recursive loop

Hi,

I am new to windows application. Can anyone give me the answer on my issue? The issue is updating the progressbar of bgworker from recursive loop. The recursive loop is using to find the directory that I want to delete. Basically, the loop is working great also the bgworker has no problem I remove the update progress function. The error is exceeding the value of progressbar. Is there anyway to update the progressbar on the fly of directory search?

Thanks
Sithu
Jun 27 '09 #1
5 4179
r035198x
13,262 8TB
What do you mean by "The error is exceeding the value of progressbar"?
Jun 29 '09 #2
IanWright
179 100+
@r035198x
He most likely means he is trying to set the ProgressBar.Value to a value larger than ProgressBar.MaxValue.

Firstly you need to check that you have initialized the MaxValue property with a sensible value, then you need to ensure that your logic isn't setting a silly value, 101% for example. If you want to be extra safe then doing a check before setting it

if(value > ProgressBar.MaxValue) { value = ProgressBar.Value;}
Jun 29 '09 #3
Hi,

Thanks for your answers. I would say straightly though, it is not the answer I expected. I am wondering how to set the max value of progresbar dynamically(the recursive loop could find unlimited directories in runtime). Is there any workaround?

Thanks
SiThu
Jun 29 '09 #4
r035198x
13,262 8TB
Well first make sure to be explicit on what you mean in your questions. As you can see there are mind readers with shiny crystal balls here who can read in between the lines to understand what you mean but it's best to be explicit so that mere mortals like me can also follow the conversation.
So you don't know how many files are going to be searched but want to show progress in terms of percentage of work done so far? Well that's just impossible. To express a percentage to need what the total is supposed to be. Better throw away that idea altogether and just show the number of files searched so far like most file searchers do.
Jun 30 '09 #5
Yeah, you are right. Thank you
Jun 30 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: peter | last post by:
Hello all, Recently I've started to refactor my code ...(I'm using python 2.3.4) I tried to add extra functionality to old functions non-intrusively. When I used a construct, which involves...
0
by: b0yce | last post by:
Hi all, I am trying to create a recursive loop transformation that remembers last position of inner loop so that it continues from that point instead of the point from where the recursion...
4
by: Ryan Ternier | last post by:
I have a section of my project that is Driving me nuts. No one has been able to help that much on it, so i thought of posting it here in hopes someone could help. I need to print out an...
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...
5
by: monmonja | last post by:
Hi i'm new to xsl and i have been using smarty php templating but its just so hard to read codes in smarty/php/flash than xml/xsl/flash, i rather sacrifice speed then not being able to read code...
5
by: Michael M. | last post by:
I have the following code (listed at bottom of post) that pings a small range of IP address to see which ones are alive. To speed things up a little I am trying to use more than one thread,...
3
by: bluefox | last post by:
By using a recursive loop find out the sum of 1+1/2+1/3+1/n with an 'n' input... So i came up with the above code..but there's problem I can't figure out... Analyze: when n =1; the...
4
by: maheswaran | last post by:
Hi all, I have problem in getting data from database using recursive function... I have the table called "master_info" project id | Child_of | Project_name...
7
by: jefe | last post by:
I have 8 header files in a cpp project, and some cross refer to each other: ie #include "Observer.h" in file "Subject.h" #include "Subject.h" in file "Observer.h"
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.