This project is read-only.

no Events?

Nov 27, 2009 at 2:31 PM


i make the following VPN-Connection

// VPN Verbindung aufbauen

RasDialer dialer = new RasDialer();
dialer.EntryName = "SPPVPN";
dialer.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User);
dialer.DialAsync(new System.Net.NetworkCredential("vpn-user1", "geheim"));

Here my Event Section.

private void rasDialer1_StateChanged(object sender, StateChangedEventArgs e)
   tbvpnout.AppendText(string.Format("{0}\r\n", e.State.ToString()));

private void rasDialer1_DialCompleted(object sender, DialCompletedEventArgs e)
    if (e.Cancelled)
        label10.Text = "Verbindunggsabbruch";
    else if (e.TimedOut)
    else if (e.Error != null)
       tbvpnout.AppendText(string.Format("Fehler: {0}\r\n", e.Error.ToString()));
       tbvpnout.AppendText(string.Format("Verbindung ist aufgebaut\r\n"));

my Code make a vpn connection. bud i don´t recieve a event for dialcompled
or statuschange.


Thomas Lauer


Nov 27, 2009 at 5:11 PM

I can't assume anything and since I don't see in your code anywhere that you connect the event to the method I have to ask... did you forget to connect them together?

dialer.DialCompleted += new EventHandler<DialCompletedEventArgs>(this.rasDialer1_DialCompleted);
dialer.StateChanged += new EventHandler<StateChangedEventArgs>(this.rasDialer1_StateChangedEventArgs);

Nov 29, 2009 at 12:09 PM

Hi Jeff,

thanks for your help. i use the event with the GUI.

Can i send you my sourcecode?





Nov 29, 2009 at 7:55 PM

Sorry, but I don't repair code from other people... you'll need to fix your own application.

The events from the project are working just fine, I would have heard a lot of complaints if they weren't since all components in the project derive from the RasComponent class which is where the event raising method resides.

Nov 30, 2009 at 8:29 AM

Hi Jeff,

sorry i don´t want to give you my full sourceode for repair. i want to make a small sample for my problem.

The Autoecode Generator from Visual Studio 2008 generate this code.

// rasDialer1
// <font size="2">



this.rasDialer1.EapData = null;
this.rasDialer1.DialCompleted += new System.EventHandler<DotRas.DialCompletedEventArgs>(this.rasDialer1_DialCompleted);
this.rasDialer1.StateChanged += new System.EventHandler<DotRas.StateChangedEventArgs>(this.rasDialer1_StateChanged);


i found my problem. i forgot the this bevor my code line:

tbvpnout.AppendText(string.Format("{0}\r\n", e.State.ToString()));

this.tbvpnout.AppendText(string.Format("{0}\r\n", e.State.ToString()));

Thomas Lauer

Nov 30, 2009 at 2:11 PM

I'm glad to hear you got it working.