Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am a newbie to VB.net and have been reading manuals but would appreciate it if somebody could point me in the right direction.

I want to click a button and connect to the internet if not already connected - something which I achieved in VB6 with wininet.dll.

 

Is there a better way of doing this now in .net??

Posted

I ran this code through the upgrade wizard from VB6 to VB.net and this was the result. I noticed that the data types have been changed from Longs to Integers however I changed tried changing them back to Longs with no success.

The first piece of code is from my form and is the line which attempts to make the connection.

 

<code>

hConnection = InternetConnect(hOpen, "ftp.mysite.com", INTERNET_INVALID_PORT_NUMBER, "user", "password", INTERNET_SERVICE_FTP, dwSeman, 0)

</code>

 

<code>

Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _

(ByVal hInternetSession As Integer, ByVal sServerName As String, ByVal nServerPort As Short, ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Integer, ByVal lFlags As Integer, ByVal lContext As Integer) As Integer

 

Public Declare Function InternetCloseHandle Lib "wininet.dll" _

(ByVal hInet As Integer) As Integer

 

Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _

(ByVal sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Integer) As Integer

</code>

Posted

Divil

Typically I think I've just managaed to get it working although at this point I'm not quite sure how. I hope I haven't wasted your time.

Many Thanks.

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...