|
-
Feb 2nd, 2007, 07:22 AM
#1
Thread Starter
New Member
Progressbar apperars so much late in visual basic Activex...!
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:
VB Code:
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) > 0
but 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....
Last edited by Hack; Feb 2nd, 2007 at 08:02 AM.
Reason: Added [vbcode] [/vbcode] tags and indenting
-
Feb 2nd, 2007, 01:40 PM
#2
Re: Progressbar apperars so much late in visual basic Activex...!
DoEvents slows your program down each time it's encountered:
VB Code:
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) > 0
How 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.)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|