|
-
Nov 3rd, 2000, 07:27 PM
#1
Thread Starter
PowerPoster
I noticed in the menu editor that it doesn't allow for esc, page up, or page down to be a short cut?? Is there a way around this?? I know i can use the KeyPress event, but I'm not sure where to put the code?? i just want to enable the user to push escape anytime during the program, and for the program to terminate.. thanks you
-
Nov 3rd, 2000, 07:32 PM
#2
Fanatic Member
Set the Form's KeyPreview Property to True
Then add this code:
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then
'code to termanate(unload all forms)
End If
End Sub
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Nov 3rd, 2000, 07:59 PM
#3
Fanatic Member
how about using vbKeyEsc that works... sometimes... try it at least...
give it a shot
-
Nov 3rd, 2000, 08:00 PM
#4
Fanatic Member
whooops!
I guess gwdash already answered... thnx
-
Nov 3rd, 2000, 08:01 PM
#5
Fanatic Member
u might wanna replace:
'code to termanate(unload all forms)
with:
End
-
Nov 3rd, 2000, 08:05 PM
#6
Hyperactive Member
MoMad:
Using End on this board is sacreligious!
-
Nov 3rd, 2000, 08:16 PM
#7
Fanatic Member
That's why i said it the way i did, i don't want to start a Holy War!!!!!
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Nov 3rd, 2000, 09:43 PM
#8
END should never be used by itself.
Use this code to end your program:
Code:
Public Sub UnloadAllForms()
Dim Form As Form
For Each Form In Forms
Unload Form
Set Form = Nothing
Next Form
End Sub
Usage
UnloadAllForms
And in your menus, if you want to emulate a shortcut key, like that space between the words and a shortcut:
Code:
mnuExit.Caption = "&Exit" & Chr$(9) & "Esc"
-
Nov 3rd, 2000, 11:01 PM
#9
Thread Starter
PowerPoster
..
Thanks everyone for the responses, it's been while since i have programmed in vb, i understand everything about what mathew gates said, but what does the set form = nothing do?? thanks
-
Nov 3rd, 2000, 11:19 PM
#10
It will free up any resources that your form is using from memory .
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
|