PDA

Click to See Complete Forum and Search --> : Progressbar apperars so much late in visual basic Activex...!


mobildev
Feb 2nd, 2007, 07:22 AM
Hi,
I made an activex (with visual basic 6.0), that downloads a file to client..I converted cab file with package&deployment wizard, and signed it..
There is an progressbar on the usercontrol(activex control form)..
and set the progressbar value appropriate value while downloading..
I use these lines:Do
DoEvents
bData = InetDwn.GetChunk(CHUNK, icByteArray)
DoEvents
If i Mod (downloading_file_all_size / 10) = 0 Then
' I used this line to increase progressbar value every 10 percent
'downloaded
DoEvents
DoEvents
ProgressBar1.Value = ProgressBar1.Value + 1
DoEvents
DoEvents
i = 0
DoEvents
DoEvents
End If
DoEvents
DoEvents
Put #intfile, , bData
i = i + 1
Loop While UBound(bData, 1) > 0but progressbar is appeared after all downloading and show %100....
(I wrote "DoEvents" much, to progressbar works properly, But this does not help..)
How can I solve this problem..?

Please HELP....

Al42
Feb 2nd, 2007, 01:40 PM
DoEvents slows your program down each time it's encountered:Do
bData = InetDwn.GetChunk(CHUNK, icByteArray)
If i Mod (downloading_file_all_size / 10) = 0 Then
' I used this line to increase progressbar value every 10 percent downloaded
ProgressBar1.Value = ProgressBar1.Value + 1
DoEvents
i = 0 'what is this for?
End If
Put #intfile, , bData
i = i + 1
Loop While UBound(bData, 1) > 0How many chunks are you downloading? You have to download at least 11 chunks for the progressbar to show more than 1 change.

What is the maximum value of the progressbar? If you leave it at the default of 100, each increment will move it by 1%, so unless you have 100 chunks, you won't really get what you want. If you determine the number of chunks first, and set the .Max to that number, you'll get 10 jumps in the progressbar. If you just increment it after every chunk you'll get 100 jumps, so it'll look a lot smoother. (Downloading takes a LOT longer than changing the progressbar, so it won't slow your downloading.)