|  | 
 | 
|  | ||
| 
 | 
| Subject:
Visual Basic programminq question Category: Computers > Programming Asked by: michned-ga List Price: $2.00 | Posted:
01 Feb 2005 15:52 PST Expires: 03 Mar 2005 15:52 PST Question ID: 467232 | 
| For Visual Basic 5.0, how would I create code that lets me press the F1 key to close the program I am writing. I would also like to add a prompt for a password that the user would need to enter for the app to close. So the sequence would be 1) press F1, 2) enter password, so that 3) program closes. | 
|  | ||
| 
 | 
| There is no answer at this time. | 
|  | ||
| 
 | 
| Subject:
Re: Visual Basic programminq question From: ob1murry-ga on 02 Feb 2005 07:17 PST | 
| Im not sure if you can assign F1 as the key since it is a function key, but if you can, use the menu editor to create a menu with a Quit option and assing the F1 key as the shortcut key, if that doesnt work you have to write your own sub-procedure to wait for a key to be pressed and checks the hex value to see if it matches the hex value of the F1 key. Then you could either create a second form(say X) with a textbox, and show it(X.show) from within the Form_Unload event in the program, or you could use an input box that is coded in the Form_Unload event, then just use an if statement to see if the password matches, if it does than End, if not then return. | 
| Subject:
Re: Visual Basic programminq question From: max_-ga on 18 Feb 2005 12:02 PST | 
| Or better you can use the Form_KeyDown(KeyCode As Integer..) event, the F1 KeyCode is 112. For the password you can create a second form and show it as modal, so the user can't use the main window until he enters the right password. | 
| If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. | 
| Search Google Answers for | 
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |