Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

VB6 - Run-Time Error 55 - File already open File Download

$
0
0
Hi,

I am using Jmacp's Asynchronous download User Control to download files of over 500MB. However, I noticed that I receive a number of errors, one of which is "Run-Time Error 55 - File already open" I have managed to track download the part of the code causing the problem, although, I have no idea how to fix it?

vb Code:
  1. Private Sub UserControl_AsyncReadComplete(AsyncProp As AsyncProperty)
  2.    
  3.     Dim intFile  As Integer
  4.     Dim bBytes() As Byte
  5.     intFile = FreeFile()
  6.     Open App.Path & "\Error.Log" For Append As #ff
  7.    On Error GoTo errHandler
  8.    
  9.     Select Case AsyncProp.PropertyName
  10.  
  11.         Case "file"
  12.             Open App.Path & "\" & strFilename For Binary As #intFile
  13.                 Print #ff, "Before Bytes"
  14.                 bBytes = AsyncProp.Value
  15.                 Put #1, , bBytes
  16.             Close #intFile
  17.            
  18.             txtDest.Text = "File saved to " & App.Path & "\" & strFilename
  19.             Print #ff, "After File saved to"
  20.             cmdFile.Enabled = True
  21.     End Select
  22.    
  23.     lblProgress.Visible = False
  24.     lblPercent.Caption = "0%"
  25.     Close #ff
  26.     Exit Sub
  27.    
  28. errHandler:
  29.     MsgBox Err.Number & " " & Err.Description
  30. End Sub

As you can see it just jumps straight to the "errHandler".


Nightwalker

Viewing all articles
Browse latest Browse all 21266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>