Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 don't know from where? I can't find any control in the tool box or wherever that has anything to do with the internet transfer control?

 

Would appreciate some help here :)

  • *Experts*
Posted

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.

Posted

Thanx :)

 

I'm 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..

  • Administrators
Posted

At the top of the form module put

Imports System.Net
Imports System.Text

 

and in the button click paste the following

 

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.

http://www.b3ta.com

will fail

http://www.b3ta.com

should work

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...