|
-
Mar 21st, 2005, 11:54 PM
#1
Thread Starter
Lively Member
Need help with ProgressBar
Hi All in VB land
I'm trying to make my file copy work with a progress bar
I’m trying to make my progress bar looks at the file size and progress at about the speed that it is copying. Is this possible? I’m not looking for anything fancy just for it too work.
Thanks everyone
-
Mar 21st, 2005, 11:59 PM
#2
Re: Need help with ProgressBar
well im not sure if this is waht you need, but here.
VB Code:
Dim vtData() As Byte
Dim FreeNr As Integer
Dim SizeDone As Long
Dim bDone As Boolean
Dim GetPerc As Integer
FreeNr = FreeFile
Open App.Path & "\yay.rar" For Binary Access Write As FreeNr 'file your copying or whatever
'this shows the status in real time
'kinda fancy
Do While Not bDone
vtData = Inet1.GetChunk(1024, icByteArray) ' Get next chunk.
SizeDone = SizeDone + UBound(vtData)
lblStatus.Caption = SizeDone \ 1024 & "kb" & "/" & m_FileSize \ 1024 & "kb"
GetPerc = (SizeDone / m_FileSize) * 100
If GetPerc > 100 Then GetPerc = 100
If GetPerc < 0 Then GetPerc = 0
Me.Caption = "AutoUpdater - " & GetPerc & "%"
Put #FreeNr, , vtData() 'chunk wegschrijven naar bestand
If UBound(vtData) = -1 Then
bDone = True 'Er zijn geen chunks meer, KLAAR DUS
Else
DoEvents 'Yield to other processes
End If
Loop
Close FreeNr
use the getperc to find the progress..this is not my code
-
Mar 22nd, 2005, 12:03 AM
#3
Re: Need help with ProgressBar
Most programs that shows a file copy progress, like a setup program for example, updates the progress after each file has been copied. But if your files are so large that you want to show the progress while they are copied you need to write your own copy procedure. Read and write the file in chunks and update the progressbar accordingly.
-
Mar 22nd, 2005, 12:20 AM
#4
Thread Starter
Lively Member
Re: Need help with ProgressBar
-
Mar 22nd, 2005, 12:22 AM
#5
Re: Need help with ProgressBar
In the above code it's a byte array.
-
Mar 22nd, 2005, 12:25 AM
#6
Thread Starter
Lively Member
Re: Need help with ProgressBar
I get An error
"Object required"
vb Code vtData = Inet1.GetChunk(1024, icByteArray) ' Get next chunk.
-
Mar 22nd, 2005, 12:27 AM
#7
Re: Need help with ProgressBar
Well that code uses an inet control to read data from the Net. Is that what you're trying to do?
-
Mar 22nd, 2005, 12:31 AM
#8
Thread Starter
Lively Member
Re: Need help with ProgressBar
No I just want to copy a file from my C drive to the floppy drive. It's just a G code text file.
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
|