|
-
Feb 16th, 2003, 07:47 PM
#1
Thread Starter
New Member
Is this code right
I'm trying to create a prog. which allows a user to enter username and password within 20 seconds. if username/password is not entered within the time allowed prog should terminate, as well as if pwd/ username not entered corrrectly a message shold pop up. Can some one look at this code and tell me where i'm going wrong.
thank you.
Private Sub grp1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grp1.Enter
Dim Username As String = New String("mark")
Dim Password As String = New String("pass")
Dim intCount As Integer = New Integer()
End Sub
Private Sub txtUser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUser.TextChanged
If (txtUser.Text) = "mark" And _
(txtPass.Text) = "Pass" Then
MsgBox("Logged in...", MsgBoxStyle.Information, "Logged in...")
Else
If Not (txtUser.Text) = "mark" Then
MsgBox("worng username", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Auth")
Exit Sub
Else
If Not (txtPass.Text) = "pass" Then
MsgBox("wrong password", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Auth.")
End If
End If
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
-
Feb 16th, 2003, 10:29 PM
#2
Sleep mode
You are verifying username and password through keychange event . It's completely wrong . It checks the data entered chr by chr . You can paste your code in a button rather than textboxchange event .
-
Feb 16th, 2003, 10:58 PM
#3
Thread Starter
New Member
i'm trying to get the user to logon only twice but cant seem to do that cant you guide me a bit on that code
-
Feb 17th, 2003, 03:31 AM
#4
Hyperactive Member
next time u post a code put it between [.vbcode] [/Highlight] tags...
Without the dot (.)
btw, thought that i posted an small example somewhere in the VB.Net area, just use search to find it
Last edited by phrozeman; Feb 17th, 2003 at 03:34 AM.
There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me
-
Feb 17th, 2003, 04:24 PM
#5
Sleep mode
this would give the user 2 attempts , if he failed the code will stop executing and showing "Contact your......"
VB Code:
Dim intCount As Integer = 0
Private Sub grp1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grp1.Click
Dim Username As String = New String("mark")
Dim Password As String = New String("pass")
intCount = intCount + 1
If intCount >= 3 Then
MsgBox("Contact your administrator for more Info ")
Exit Sub
End If
If (txtUser.Text) = "mark" And _
(txtPass.Text) = "Pass" Then
MsgBox("Logged in...", MsgBoxStyle.Information, "Logged in...")
Else
If Not (txtUser.Text) = "mark" Then
MsgBox("worng username", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Auth")
Exit Sub
Else
If Not (txtPass.Text) = "pass" Then
MsgBox("wrong password", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Auth.")
End If
End If
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|