PDA

Click to See Complete Forum and Search --> : How do I download a file from the internet in VB? Am I really this stupid?


krah
Jun 18th, 2000, 11:19 AM
I have Vb6. I am exceptionally confused. Is Inet the answer?
Let's say I want to download this file...

http://www.blablabla.com/yackety-schmackety.htm

...to my hard drive. How is it done? Help is greatly appreciated and abbreviations for yackety-schmackety in explanations or examples are acceptable!


P.S. After posting this message I found out that www.blablabla.com is a real website and I advise you don't go there it's a pain in the butt.

[Edited by krah on 06-19-2000 at 12:22 AM]

Mark Sreeves
Jun 18th, 2000, 02:31 PM
Try this...

(I can't comment whether or not you are stupid):)





Private Sub Command1_Click()
Inet1.AccessType = icUseDefault
Dim b() As Byte
Dim strURL As String

' Presuming this is still a valid URL.
strURL = http://www.blablabla.com/yackety-schmackety.htm
' Retrieve the file as a byte array.
b() = Inet1.OpenURL(strURL, icByteArray)

Open "C:\Temp\yackety-schmackety.htm" For Binary Access _
Write As #1
Put #1, , b()
Close #1
MsgBox "Done"
End Sub