我正在爲我的網站進行登錄和註冊表單,我需要知道如何才能做到這一點,以便如果人們將註冊表單留空或空,我怎樣才能阻止我程序從創建該帳戶,它會顯示一條錯誤消息。請讓我知道你在想什麼。謝謝!Visual Basic登錄表
這是我的登記表的代碼:
公共類窗體2
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)
If String.IsNullOrEmpty(TextBox1.Text) Then
MessageBox.Show("Please enter a Salesperson's name", "No entry")
Else
My.Settings.Username = TextBox1.Text
My.Settings.Password = TextBox2.Text
My.Settings.Save()
MsgBox("Create Account", MsgBoxStyle.Information, "Register")
Form1.Show()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Hide()
Form1.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
My.Settings.Username = TextBox1.Text
My.Settings.Password = TextBox2.Text
My.Settings.Save()
MsgBox("Create Account", MsgBoxStyle.Information, "Register")
Form1.Show()
Me.Close()
End Sub
末級
這是我的登錄碼:
公共類Form1中
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = My.Settings.Username And
TextBox2.Text = My.Settings.Password Then
Form3.Show()
Me.Hide()
Else
MsgBox("Incorrect Username or Password!", MsgBoxStyle.Information, "Error")
End If
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Form2.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
結束類別
任何想法?
你的標題說的是visual basic,代碼看起來像visual basic,但是你把它標記爲'c#',想知道你是否對它進行了錯誤標記。 – Jon
等等...密碼存儲在純文本xml設置文件中!這真的不好。你需要閱讀關於bcrypt。 –