Saving User name and Password in Visual Basic

  • Thread starter Thread starter Frozen_Nova
  • Start date Start date
F

Frozen_Nova

Guest
Hi, I wanted to know if it is possible to save the Username and Password of a users input. So in the code below, I created two variables called username and password, I prompt the user to make a Username and Password, but, I do not want to prompt the user every time they start the program to create a Username and Password, is there any way for me to store their Username and Password so that the next time they start the program, it will not prompt them for a user name and password, but it will just go to enter you Username and Password


Public Class Form1
Dim username As String
Dim password As String
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
'username = InputBox("What do you want your Username to be?")
'password = InputBox("What do you want your Password to be?")
If TextBox1.Text = username And TextBox2.Text = password Then
MsgBox("You are logged in ")
Form2.Show()
Else
MsgBox("Sorry Wrong Username and or Password")
End If
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
username = InputBox("What do you want your Username to be?")
password = InputBox("What do you want your Password to be?")
End Sub
End Class

Continue reading...
 
Back
Top