Question : How to save the VPN profile for reconnecting

Hello everyone

I just configured remote client VPN to access my windows server 2003 and be able to backup and work on w2k3 shares. Now if the clients reboot their laptops or disable the VPN connection the connection they used to connect is now gone. If i re-enable the cisco vpn client I have to manually re-enter the ip addresses in the properties windows of Internet protocol (TCP/IP). Is there a way to save this so they don't have to re-enter this information all the time?

Other than that no problem accessing the shares etc...

Thanks

Answer : How to save the VPN profile for reconnecting

Here's an example of how to "wire up" ALL 72 TextBoxes to the same event handler at run-time so you don't have to manually create 72 different handlers in the IDE.

Also included are examples of how to implement Left, Right, Up and Down buttons:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
Public Class Form1

    Private LastTextBox As TextBox = Nothing

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim tb As TextBox
        Dim ctls() As Control
        For i As Integer = 0 To 71
            ctls = Me.Controls.Find("TextBox" & i, True)
            If ctls.Length > 0 AndAlso TypeOf ctls(0) Is TextBox Then
                tb = CType(ctls(0), TextBox)
                AddHandler tb.GotFocus, AddressOf tb_GotFocus
            End If
        Next
    End Sub

    Private Sub tb_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim tb As TextBox = CType(sender, TextBox)
        LastTextBox = tb
    End Sub

    Private Sub btnRight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRight.Click
        If Not IsNothing(LastTextBox) Then
            Dim i As Integer
            Dim strInt As String = LastTextBox.Name.Remove(0, "TextBox".Length)
            If Integer.TryParse(strInt, i) Then
                If ((i + 1) Mod 9) <> 0 Then
                    i = i + 1
                    Dim ctls() As Control = Me.Controls.Find("TextBox" & i, True)
                    If ctls.Length > 0 AndAlso TypeOf ctls(0) Is TextBox Then
                        Dim tb As TextBox = CType(ctls(0), TextBox)
                        tb.Focus()
                    End If
                Else
                    LastTextBox.Focus()
                End If
            End If
        End If
    End Sub

    Private Sub btnLeft_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLeft.Click
        If Not IsNothing(LastTextBox) Then
            Dim i As Integer
            Dim strInt As String = LastTextBox.Name.Remove(0, "TextBox".Length)
            If Integer.TryParse(strInt, i) Then
                If (i Mod 9) <> 0 Then
                    i = i - 1
                    Dim ctls() As Control = Me.Controls.Find("TextBox" & i, True)
                    If ctls.Length > 0 AndAlso TypeOf ctls(0) Is TextBox Then
                        Dim tb As TextBox = CType(ctls(0), TextBox)
                        tb.Focus()
                    End If
                Else
                    LastTextBox.Focus()
                End If
            End If
        End If
    End Sub

    Private Sub btnUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUp.Click
        If Not IsNothing(LastTextBox) Then
            Dim i As Integer
            Dim strInt As String = LastTextBox.Name.Remove(0, "TextBox".Length)
            If Integer.TryParse(strInt, i) Then
                If i > 8 Then
                    i = i - 9
                    Dim ctls() As Control = Me.Controls.Find("TextBox" & i, True)
                    If ctls.Length > 0 AndAlso TypeOf ctls(0) Is TextBox Then
                        Dim tb As TextBox = CType(ctls(0), TextBox)
                        tb.Focus()
                    End If
                Else
                    LastTextBox.Focus()
                End If
            End If
        End If
    End Sub

    Private Sub btnDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDown.Click
        If Not IsNothing(LastTextBox) Then
            Dim i As Integer
            Dim strInt As String = LastTextBox.Name.Remove(0, "TextBox".Length)
            If Integer.TryParse(strInt, i) Then
                If i < 63 Then
                    i = i + 9
                    Dim ctls() As Control = Me.Controls.Find("TextBox" & i, True)
                    If ctls.Length > 0 AndAlso TypeOf ctls(0) Is TextBox Then
                        Dim tb As TextBox = CType(ctls(0), TextBox)
                        tb.Focus()
                    End If
                Else
                    LastTextBox.Focus()
                End If
            End If
        End If
    End Sub

End Class
Random Solutions  
 
programming4us programming4us