|
-
Jan 26th, 2010, 07:05 AM
#1
Thread Starter
Fanatic Member
Key code fo ALT key
Dears,
For CTRL + N we use If KeyCode = vbKeyN And Shift = 2 Then, what will we use if we want to use N Key with ALT button
Regards
-
Jan 26th, 2010, 07:10 AM
#2
PowerPoster
Re: Key code fo ALT key
If it's for sendkeys, I've a link in my sig which has all the key codes
If not, http://www.vbforums.com/showthread.php?t=587222 says vbAltMask is what you're looking for
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jan 26th, 2010, 07:11 AM
#3
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Jan 26th, 2010, 07:15 AM
#4
Re: Key code fo ALT key
Usage: If KeyCode = vbKeyN And Shift = 4 Then ~~> Alt + N
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Jan 26th, 2010, 07:17 AM
#5
Re: Key code fo ALT key
See help for KeyDown and KeyUp Events
Code:
Shift = 1 : SHIFT was pressed.
Shift = 2 : CTRL was pressed.
Shift = 4 : ALT was pressed.
Shift = 3 : CTRL+SHIFT was pressed.
...
-
Jan 26th, 2010, 07:55 AM
#6
Thread Starter
Fanatic Member
Re: Key code fo ALT key
its not working in my code. I wrote
vb Code:
If KeyCode = vbKeyN And Shift = 4 Then 'NEW
lbl_Click (0)
ElseIf KeyCode = vbKeyS And Shift = 4 Then 'SAVE
lbl_Click (1)
ElseIf KeyCode = vbKeyC And Shift = 2 Then 'Cancel
lbl_Click (2)
ElseIf KeyCode = vbKeyD And Shift = 4 Then 'Delete
lbl_Click (3)
ElseIf KeyCode = vbKeyF And Shift = 2 Then 'Find
lbl_Click (4)
ElseIf KeyCode = vbKeyX And Shift = 2 Then 'Exit
lbl_Click (5)
End If
if i use CTRL + X it works but if i use ALT + N its not work
-
Jan 26th, 2010, 07:59 AM
#7
Re: Key code fo ALT key
Where are using this code...????
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Jan 26th, 2010, 08:00 AM
#8
Thread Starter
Fanatic Member
Re: Key code fo ALT key
i have used Lables as command Buttons and want to use with KEY CODE. i m using this code in FORM_KeyDown event
-
Jan 26th, 2010, 08:06 AM
#9
Re: Key code fo ALT key
Have you set the KeyPreview property of form to True ...???
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Jan 26th, 2010, 08:08 AM
#10
Thread Starter
Fanatic Member
Re: Key code fo ALT key
KeyPreview property of form is True, thats why CTRL + Keys is working
-
Jan 26th, 2010, 08:22 AM
#11
Re: Key code fo ALT key
what will we use if we want to use N Key with ALT butt
Is this what you want?
You can check it for keydown event of textbox
Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
ShiftTest = Shift And 7
If KeyCode = vbKeyN And ShiftTest = 4 Then
MsgBox "You pressed Alt+N"
End If
End Sub
Last edited by Siddharth Rout; Jan 26th, 2010 at 08:28 AM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jan 27th, 2010, 02:08 AM
#12
Thread Starter
Fanatic Member
Re: Key code fo ALT key
I m not using this on Textbox, i need to implement it on Form
-
Jan 27th, 2010, 07:42 AM
#13
Re: Key code fo ALT key
 Originally Posted by hafizfarooq
I m not using this on Textbox, i need to implement it on Form
Set the form's KeyPreview property to True...
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
ShiftTest = Shift And 7
If KeyCode = vbKeyN And ShiftTest = 4 Then
MsgBox "You pressed Alt+N"
End If
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
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
|