|
-
Mar 26th, 2002, 03:41 PM
#1
Thread Starter
Lively Member
Progress Bar
Hello,
I am copying a file from one directory to another, I wan tthe progress bar to show be activated, for the end user knows that a processing thing is going on.
How can I do this.
progressbar.value = ??????
In ordinary cases, where I can access the progress bar in a loop, I use this way.
Is there any specific changes, or property I have to recognise?
Thanks for your help.
-
Mar 26th, 2002, 03:46 PM
#2
PowerPoster
Well
Ever notice how on some programs the last part of the progress bar seems to fly by?
Use a timer to add a value to the Progressbar.value property at an iterval of your liking...
The max value of the progress bar needs to be reasonable, but far ahead of what time it would take to finish the task. At the end of the task set the value to 100.
Easy cheesy, but it works.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 26th, 2002, 03:47 PM
#3
Frenzied Member
I don't think you can do this with copying just one file. I mean how do you know how much copying has taken place and how much is left?
With more than 1 file you can do it based on the file count.
-
Mar 26th, 2002, 03:51 PM
#4
PowerPoster
Well
The point is a reasonable visual interpretation. Say it would take 5 seconds to copy 5 megs on a 1 GIG machine. Create a function which can figure a factor based of the size of the data and the speed of the computer. As far as time, add 10 % to the returned number. See what I am getting at?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 26th, 2002, 04:11 PM
#5
Frenzied Member
Oh, OK.
So you have to predict.
-
Mar 26th, 2002, 04:21 PM
#6
-= B u g S l a y e r =-
-
Mar 26th, 2002, 04:42 PM
#7
Thread Starter
Lively Member
Small Note
Hello,
Thanks for you all for the Ideas, but I want to add a samll details, I am using "FileCopy " methode.
If this may advance the conversation.
-
Mar 26th, 2002, 04:45 PM
#8
-= B u g S l a y e r =-
when using filecopy, there is no way of knowing how far in the copy process u are.
think u have to "fake" it, as they have suggested abow
-
Mar 27th, 2002, 08:58 AM
#9
PowerPoster
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 27th, 2002, 04:03 PM
#10
Thread Starter
Lively Member
timer didn't work
Hello
I activated the timer before the copy process, but it didn't activate.
I used the following codes.
i =0
timer.enable = true
filecopy from, to
timer.enable = false
private sub timer_timer
i = i+1
progress_bar.value = i
end sub
So what do yuo suggest?
-
Mar 27th, 2002, 05:51 PM
#11
-= B u g S l a y e r =-
no u'r right... sorry didn't think of that... 
u won't get any processor time to do the update of the progress bar when the file is beeing copied.
Did u try the sample in the link I posted earlier in this thread?
could u use that?
-
Mar 27th, 2002, 05:57 PM
#12
Lively Member
A file doesn't just appear in the other directory right? I think that if you set the max value as the value of the LenB(yourFile) and you set a timer to fire off every .1 or .2 of a second, and looked at the size of file in the copy location and set the ProgressBar.Value = LenB(theFileInTheCopyLocation)? Haven't tested it, but it seems like it would work.
In case of a water landing, my head may be used as a flotation device.
-
Mar 27th, 2002, 05:58 PM
#13
Lively Member
Ahhhhh, doesn't fire off asynchronous does it. Didn't think of that.
In case of a water landing, my head may be used as a flotation device.
-
Mar 27th, 2002, 06:22 PM
#14
Lively Member
Because I don't like being defeated by myself.
One way is to make a seperate, really tiny executable to do the copying for you.
VB Code:
Public Sub Form_Load()
'assume Command is sent with a * as a delimiter
filecopy Mid(Command, 1, InStr(Command, "*") -1), to Mid (Command, InStr(Command, "*") + 1)
End Sub
Then in your code, Shell to the Executable, and start your timer
VB Code:
Public Sub CopyMe_Click()
ProgressBar.Max = LenB(fileToCopy)
Shell("locationOfNewExecutable fileToCopy*newLocation", 6)
Timer.Enable = True
End Sub
Private Sub Timer_Timer()
ProgressBar.Value = LenB(newLocation)
If ProgressBar.Value = ProgressBar.Max Then: Timer.Enabled = False
End Sub
That'll work.
In case of a water landing, my head may be used as a flotation device.
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
|