Save password to Registry.
1:
2: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
3: Application.DoEvents()
4: BrowserForm_Instance.Hide()
5: Using LogonKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Jotform_Addins2", True)
6: If LogonKey Is Nothing Then
7: Using SOFTWARE As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE", True)
8: Using MyKey As Microsoft.Win32.RegistryKey = SOFTWARE.CreateSubKey("Jotform_Addins2")
9: MyKey.SetValue("Login", LoginTextBox.Text)
10: MyKey.SetValue("Pass", PassTextBox.Text)
11: End Using
12: End Using
13: Else
14: LoginTextBox.Text = LogonKey.GetValue("Login")
15: PassTextBox.Text = LogonKey.GetValue("Pass")
16: End If
17: End Using
18: End Sub
19:
20: Private Sub LoginButton_Click(sender As Object, e As EventArgs) Handles LoginButton.Click
21: Using LogonKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Jotform_Addins2", True)
22: If LogonKey Is Nothing Then
23: Using SOFTWARE As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE", True)
24: Using MyKey As Microsoft.Win32.RegistryKey = SOFTWARE.CreateSubKey("Jotform_Addins2")
25: MyKey.SetValue("Login", LoginTextBox.Text)
26: MyKey.SetValue("Pass", PassTextBox.Text)
27: End Using
28: End Using
29: Else
30: Using MyKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Jotform_Addins2", True)
31: MyKey.SetValue("Login", LoginTextBox.Text)
32: MyKey.SetValue("Pass", PassTextBox.Text)
33: End Using
34: End If
35: End Using
36: BrowserForm_Instance.LoginScript = "$('input#username.loginField').val('" & LoginTextBox.Text & "');$('input#password.loginField').val('" & PassTextBox.Text & "');$('input#loginButton.buttonz').click();"
37: BrowserForm_Instance.Show()
38: BrowserForm_Instance.WebBrowser.Load("https://eu.jotform.com/login")
39: GoButton.Enabled = True
40: End Sub
Comments (
)
Link to this page:
//www.vb-net.com/SavePassToRegistry/index.htm
|