using the internet transfer control with Visual Basic .Net

kimrune

Member
Joined
Jun 24, 2003
Messages
7
Hey..

I would like to use the internet transfer control, but when adding this code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Inet1.Protocol = icHTTP
Inet1.URL = Text1.Text
Inet1.Execute(, "GET")
End Sub

I get build errors saying that Inet1 is not declared...

I probably need to add some controls, but the problem is, I dont know from where? I cant find any control in the tool box or wherever that has anything to do with the internet transfer control?

Would appreciate some help here :)
 
INet doesnt ship with Vs.NET so you need to have VS6 installed or get it from somewhere else to use it anywhere. And INet is not recommended for .NET. Look into those namespaces:
System.Net
System.Net.Sockets
They provide functionality you need.
 
Thanx :)

Im not too familiar with System.Net so if you know of any tutorials or if you have any hints on how to get me started in the right direction I would be very happy..

Thanx for the reply..
 
At the top of the form module put
Code:
Imports System.Net
Imports System.Text

and in the button click paste the following

Code:
Dim wc As New WebClient
Dim s As String
Dim b() As Byte
b = wc.DownloadData(TextBox1.Text)
s = Encoding.ASCII.GetString(b)

s should now be the raw text of whatever the url in textbox1 was.

ps you need to enter the protocol as part of the url

i.e.
www.b3ta.com
will fail
http://www.b3ta.com
should work
 
Back
Top