|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
File transfer progress bar
I am trying to create a progress bar for a file transfer using the FSO but I am not having any luck. I've got the progress bar ok and I understand how it works. What i am having trouble with is incrementing the bar in relation to size of the file and the amount of data transfered.
Any help would be greatly appreciated. |
|
#2
|
|||
|
|||
|
This may help
AvanceInit is where the process message is initializated AvanceHide is for hidding the progress message AvanceProgress is for showing the progress Need global variables: Avance_Count and Avance_Percent as long note: You have to track the transfer progress (By Bytes and Know the filesize <no need to be exact, you can call the hide procedure at the end with no matter of the counter>) Sub AvanceInit(Description As String, TITLE As String, Optional ByVal TOTAL As Long = 0) Avance_Count = 0: Avance_Percent = 0: Avance_Total = TOTAL Avance.Descripcion = Description Avance.Caption = TITLE If TOTAL <> 0 Then Avance.AvanceBar.Value = 0 Avance.AvanceBar.Visible = TOTAL <> 0 Avance.SHOW Avance.Refresh DoEvents End Sub Sub AvanceHide() Avance.Hide End Sub Sub AvanceProgress() Dim i As Long i = CLng(Avance_Count / Avance_Total * 10) * 10 If i > Avance_Percent And i < 100 Then Avance.AvanceBar.Value = i DoEvents Avance_Percent = i End If Avance_Count = Avance_Count + 1 End Sub |
|
#3
|
|||
|
|||
|
It is the tracking of the transfer progress that I am having trouble with. I have used the code below and it works alright but the problem is that it takes an extordinarly long time to process. A 1mb file that usually takes 0.45 seconds on my machine now takes more that 25 seconds with this method. I can only seem to transfer one byte at a time. Is there a way of increasing this or is there a better way?
Dim aByte As Byte Dim File1 As Integer Dim File2 As Integer File1 = FreeFile Open Source For Binary As #File1 File2 = FreeFile Open Target For Binary As #File2 Do While Not LOF(File1) < Seek(File1) Get #File1, , aByte Put #File2, , aByte 'Refresh the progressbar after every 98304 bytes transfered. If Loc(File1) / 98304 = CInt(Loc(File1) / 98304) Then 'Update progress bar End If Loop Thanks Steven |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > File transfer progress bar |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|