Tuesday, July 28, 2009

Visual Basic Key Comands & How to save a file?

Does anyone have some very easy code that can save an existing file?





Also how do you do key commands in visual basic. Say if the users hits "CTRL" + "p" on the keyboard it loads up the print page?

Visual Basic Key Comands %26amp; How to save a file?
Ctrl + p:


you have to set your forms property "KeyPreview" to True then in source code you may try this:





Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)





'Shift values ex.


'1 =Shift Key in keyboard


'2=Ctrl


'4=alt





if keycode = asc("p") and shift =2 then


'-- do somthing


endif





end Sub





hope this help :D
Reply:fren to use a ctrl or alt is in your command bottuns property go to the caption the name of the command buttons put a ampersand in beginning of the letter where you want ALT key will appear exsample ur command button is ok type in caption O%26amp;K. then try it on press the ALT+K.


No comments:

Post a Comment