need to create a prog. that allows a user to logg in with username and password. If the password is incorrect a message should appear. Also a time limit to logg in, if the time expires a friendly messageshould appear.
Printable View
need to create a prog. that allows a user to logg in with username and password. If the password is incorrect a message should appear. Also a time limit to logg in, if the time expires a friendly messageshould appear.
This is just an simple example (also added it in the attachment)
VB Code:
Public Class Form1 Inherits System.Windows.Forms.Form Dim UserName As String = New String("charles") Dim Password As String = New String("mypass") Dim intCount As Integer = New Integer() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If LCase(TextBox1.Text) = (UserName) And LCase(TextBox2.Text) = Password Then MsgBox("Logged in...", MsgBoxStyle.Information, "Logged in..") Else If Not LCase(TextBox1.Text) = UserName Then MsgBox("Wrong username", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Auth.") Exit Sub Else If Not LCase(TextBox2.Text) = Password Then MsgBox("Wrong password", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Auth.") End If End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Form1.ActiveForm.Text = "Lalalal" End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If intCount = 10 Then intCount = 0 MsgBox("Too late!!", MsgBoxStyle.Critical, "too bad") End End If intCount = (Val(intCount) + 1) Label2.Text = intCount End Sub End Class