# Opening a web page in VB6

Discussion in 'Computer Science & Culture' started by Pi-Sudoku, Dec 1, 2007.

Not open for further replies.
1. ### Pi-SudokuSlightly extremeRegistered Senior Member

Messages:
526
When i use :

open("http://website.com") for input as #1

it comes up with an error.

Can anyone recommend a better way?

3. ### RubiksMasterReal eyes realize real liesRegistered Senior Member

Messages:
1,646
What error? If you're using visual studio, can you give me the error code?

Without any more information this is hard. I'm guessing that it can't open a website because there is no actual file to open. My understanding is that the open command opens a file for access, not a website.

Maybe if you said something like
Code:
open("http://www.website.com/index.html") For Input As #1
But even then, you would have to have proper permissions (which it seems like you would if you're opening it for just input, and not I/O). And then again, maybe the web server isn't set up to accept connections from a VB program, because it comes in on the wrong port, or as some sort of malformed page request.

That's all just a rough guess. Get me the actual error message and I might be of more help.

5. ### ranthiRegistered Member

Messages:
141
its been awhile but here is what I would do..

add the "Internet Transfer Control" to your program then maybe throw this in there and see if it does whatever you wanted it to...

Code:
Dim res as String

res = Inet1.OpenURL("http://www.website.com/index.html", icString)  'icString is the datatype


I dont have vb on my comp anymore or would test before giving you that example, but when I did it before..I seem to remember having to specify either http or ftp and perhaps a port...

Its been to long ago, but I do know you can use the Internet Transfer Control to do it.