Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Length of byte array

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
I have a byte array where I put the picture from a web site. I need to check if the pic was correctly copied so I need to make sure the array is not NULL. How is that done? Here is the snippet of the code:

Dim Buffer() As Byte
Dim FileNumber As Integer

FileNumber = FreeFile()
Open URL(some URL) For Binary Access Read Write As #FileNumber

Buffer = Inet1.OpenURL(URL, icByteArray) 'this uses INET control to get the picture by bytes
'
Put #FileNumber, Buffer() 'puts image in the buffer

Now I need to check if Buffer() is not empty


thanks
 
Try using an error handler

public sub whatever()
Dim Buffer() As Byte
Dim FileNumber As Integer

on error goto errorhandler

FileNumber = FreeFile()
Open URL(some URL) For Binary Access Read Write As #FileNumber

Buffer = Inet1.OpenURL(URL, icByteArray) 'this uses INET control to get the picture by bytes
'
Put #FileNumber, Buffer() 'puts image in the buffer

exit sub
errorhandler:
if err.number="the number of the error" then
'handle the error here
else
err.raise "Raise error to the calling program"
end if
end sub


MJC
 
actually I tried that but it does nto give an error. I had the program download file from something like dhsfsf.jpg website but it created a file on the drive (it had no type and had size of 0). Any other ideas?

thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top