Connecting and disconnecting [RESOLVED]

tich

Member
Joined
Jul 27, 2005
Messages
20
Location
Beirut,Lebanon
Programming Experience
3-5
Hey all,
I'm doing a program that connects to the internet and disconnects.
I looked in msdn i found that the HNetCfg.dll will do that so this is what i wrote:
[Dim Connection as NETCONLib.INetConnection
Connection.Connect()]
But this returns a NullReference Exception although they said in msdn that this method has no parameters!
Help!!!
:(
 
You need to set it to a NEW instance of the class before using it.

Tg
 
Not clued up on interfaces but doesn't your class have to implementthe interface or is that only in C#?
 
Last edited:
Have you mentioned that all this is about interface? hmm

However, in .NET every class is a class and an interface is an interface, unlike a COM interface in VB6.

Public Class myClass

End Class

Public Interface myInterface

End Interface

Classes may contain a code. Interfaces do not contain. Moreover, classes that implement an interface contain code. Note that there are no instances of interfaces in VB .NET. Every instance is a type that implements an interface, but is itself not an instance of the interface.

Also, all types that implement an interface must implement every declared method in that interface ... this is how you should implement the interface withing class

Public Class myClass
Implements myInterface

Public Function myFunc() As String Implements myInterface.myFunc
Return "myClass"
End Function
{...}


Regards ;)
 
Ok i implemented the interface and made a private sub for each of the functions of this interface.
But the problem is now i have to write the code to connect to the internet in the connect sub.
But i donno how to do that.
PLEASE help!
 
good luck

I'm just throwing ideas now and don't know how to actually code this!
So good luck.

Why don't you use the MSComm control to communicate with the modem? You have to install vb6 though to register the component otherwise you get a
"You don't have the license to use this control" error.

try finding info about using the MSComm control unless kulrom or someone else has any other ideas.
 
Back
Top