[RESOLVED] [VB6] Successfully Login Display
Greetings all, this is wad i've done..
<code>
Private Sub txtPin_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txtPin.Text = "1234" Then
labelErrorAccount.Visible = True
labelErrorAccount.Caption = "Login Successful."
txtPin.Visible = True
Unload Me
Load frmAccount
frmAccount.Show
Else
labelErrorAccount.Caption = "Sorry, your PIN number is invalid"
labelErrorAccount.Visible = True
End If
End If
End Sub
</code>
Ok when the pin is correct, it doesnt displays "Login Successful." it straight away unloads the form and load another form. how do i make it wait for like 3seconds so it would display login successful then unload the form?
Re: [VB6] Successfully Login Display
Try this
VB Code:
'Add this to the top of the declrations
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub txtPin_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txtPin.Text = "1234" Then
labelErrorAccount.Visible = True
labelErrorAccount.Caption = "Login Successful."
txtPin.Visible = True
Sleep (500) 'wait for 500 milliseconds --->nes
Unload Me
Load frmAccount
frmAccount.Show
Else
labelErrorAccount.Caption = "Sorry, your PIN number is invalid"
labelErrorAccount.Visible = True
End If
End If
End Sub
Re: [VB6] Successfully Login Display
thanks for reply danasegarane, but it didnt work.
it waited for "x" amount of time and then unload form and load new form without showing the label. Any idea?
Re: [VB6] Successfully Login Display
Increae the value in ( ), as long as you required (in milliseconds)
VB Code:
Sleep (5000) 'wait for 500 milliseconds --->nes
Re: [VB6] Successfully Login Display
yup i know i did increase the value so it has a longer time to display but it doesnt display the label. instead it waits for the amount of time(x) and unload form and load another form.... wads wrong?
Re: [VB6] Successfully Login Display
change this for 10 seconds .ie --Sleep (10000)
Re: [VB6] Successfully Login Display
sigh.. it doesnt work.. on sleep it totally stop doing anothing making u unable to select anything and wait for 10seconds and it unload form and load another form.. totally skipped showing login successful label.. =(