Results 1 to 8 of 8

Thread: [RESOLVED] Help me open a file on the internet!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Resolved [RESOLVED] Help me open a file on the internet!

    I wrote some code for checking if it can read a file that i have on my website. The file that the program is supposed to try to open is www.guitar.gratisplaneten.com/test.txt.

    Why can't my program open the file? Is there some other way of doing this?

    Here's the code of the function:

    Function connected(hej)
    On Error GoTo notconnected
    Open "http://www.guitar.gratisplaneten.com/test.txt" For Input As #9
    Close #9
    Exit Function
    notconnected:
    If (MsgBox("The program cannot connect to the internet, check your internet and firewall settings and try again. To try again, press OK.", vbOKCancel, "No connection")) = vbOK Then
    connected (1)
    End If
    End
    End Function

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Help me open a file on the internet!

    Hi cyber_alex

    You can't just open a file off the internet, you will need to download it first.
    Use the Inet control or a webbrowser to download the text file onto your computer, and then read it from there.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Help me open a file on the internet!

    but how do I then write a file to my website?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Help me open a file on the internet!

    and why can't I just open a file from my site, the internet browser can.

  5. #5
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Help me open a file on the internet!

    Because your program isn't a internet browser!
    If your website supports FTP then you can use the Inet control to upload a file to your website and download it
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Help me open a file on the internet!

    how do I do that?

  7. #7
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Help me open a file on the internet!

    Click Project > Components > 'Microsoft Internet Transfer Control' > OK
    Add the Inet control (which should be in the toolbox now) to your form.

    When you want to download the data use
    VB Code:
    1. HTML = Inet1.OpenURL("http://www.guitar.gratisplaneten.com/test.txt")
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Help me open a file on the internet!

    thanks

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