Results 1 to 2 of 2

Thread: How do I download a file from the internet in VB? Am I really this stupid?

  1. #1

    Thread Starter
    Addicted Member krah's Avatar
    Join Date
    Jan 1999
    Location
    Arkansas, her hyuck!
    Posts
    163

    Question

    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]
    Is it tired in here or is it just me?

    Ryan Williams
    -Using Vb6-

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Try this...

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


    Code:
    
    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
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width