This project is read-only.

Example Disconnect Error

Jan 19, 2011 at 3:55 AM

After Successful connection when I press disconnect I get this error 

Value cannot be null.Parameter name: handle


 Dim connection As RasConnection = RasConnection.GetActiveConnectionByHandle(Me.connectionHandle)

I can't figure out what Is the problem because I'm still new to, so If you can help me fix this (With code example)

I will appreciate that been stuck with this for hours checked google but there is no other examples. I'm just trying to disconnect but it just don't work :(


Thanks you.

Jan 19, 2011 at 6:03 AM

Dear the method that i use to disconnect is

If (Me.RasDialer.IsBusy) Then Me.RasDialer.DialAsyncCancel() Else
Dim EntryName As String = "VPN Connection"
 Dim Mypbk = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers).ToString() Dim MyConn As RasConnection = RasConnection.GetActiveConnectionByName(EntryName, Mypbk) If (MyConn IsNot Nothing) Then MyConn.HangUp() MsgBox("VPN Disconnected") End If End If