|
-
Jan 4th, 2001, 11:13 AM
#1
I would like so that when the user presses the cobination of: 0-5-1-3 any time during the form it makes a label visible.
-
Jan 4th, 2001, 11:27 AM
#2
Fanatic Member
This should do the trick, just make sure you set the KeyPreview property of your form to True and that you have a Label named Label1 and that it's Visible property is set to false.
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
Static sLast4 As String
If Len(sLast4) = 4 Then
sLast4 = Right(sLast4, 3)
End If
sLast4 = sLast4 & Chr(KeyAscii)
If sLast4 = "0513" Then Label1.Visible = True
End Sub
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Jan 4th, 2001, 11:28 AM
#3
Retired VBF Adm1nistrator
Well, just remember what the user has entered, and if the cheat code is in the text they've entered, then show the label.
Once the cheat code has been entered, you'd want to clear the buffer so that the label can be shown again at a later stage.
Dim entered as string
Private Sub Form_KeyPress(KeyAscii As Integer)
entered = entered & Chr(KeyAscii)
If (InStr(1, entered, "0513", vbTextCompare) <> 0) Then
entered = ""
Label1.visible = true
End If
End Sub
-
Jan 4th, 2001, 11:34 AM
#4
can i ask you guys one thing, Why do you use static to declare a variable instead of dim?
-
Jan 4th, 2001, 11:36 AM
#5
Fanatic Member
Using Static to declare variables allow the variable to hold it's data between function calls.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Sep 21st, 2003, 04:05 PM
#6
Retired VBF Adm1nistrator
*bump*
The first question I ever helped to answer. And nearly three years later, I'm still here
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Sep 22nd, 2003, 02:36 AM
#7
Conquistador
i'll try and dig up the first question i answered 
?
Last edited by da_silvy; Sep 22nd, 2003 at 02:41 AM.
-
Sep 22nd, 2003, 03:03 AM
#8
Conquistador
-
Sep 22nd, 2003, 11:02 AM
#9
Frenzied Member
Originally posted by plenderj
*bump*
The first question I ever helped to answer. And nearly three years later, I'm still here
Aww, so proud *wipes tear*
-
Sep 22nd, 2003, 05:09 PM
#10
-
Sep 23rd, 2003, 12:39 AM
#11
Frenzied Member
Mine even though I didn't really help out too much. How can I get a custom title?
-
Sep 23rd, 2003, 03:21 AM
#12
Conquistador
You can't.
They were discontinued in the Custom Title fire of 2000
-
Sep 23rd, 2003, 05:56 PM
#13
-
Oct 5th, 2003, 01:17 AM
#14
Conquistador
you do...
hello humour
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
|