using the internet transfer control
-
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 :)
-
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 :)
You can add the internet transfer control by adding a reference to the msinet.ocx activex component. First, right click on the project name in solution explorer, and go to Add Reference -> COM -> Browse. Browse for MSINET.OCX, it should be in your system directory (usually c:\windows\system32 for winXP). .NET will automatically reference the object and create a managed wrapper class for it (in the form of AxCLASSNAME). You can then add this component into your project. There are however, drawbacks to this. Wrapping an ActiveX control in .NET increases overhead. There are a few solutions built into .NET that come to mind. 1) The easiest solution uses the System.Net namespace and the HttpWebRequest and HttpWebResponse classes. You can use these classes to retrieve whatever document you wish using the HTTP protocol. For more information, see the HttpWebResponse class by navigating your VS.NET help to the following: ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemnethttpwebresponseclasstopic.htm 2) The second solutions gives you far more control by using sockets directly. By using the System.Net.Socket class, you can create to a remote host (port 80 is usually HTTP port), and the form a GET request using the HTTP protocol. This solution is not recommended because .NET has already built classes to handle http requests (solution #1). This class can be used for custom protocols. - Joe