|
-
Oct 29th, 2002, 08:20 PM
#1
Thread Starter
Addicted Member
Detecting Control/Alt Keys
Can someone tell me why this code doesn't work for Control/Alt keys, and another way to detect them? If it's easier, you could just explain how to assign Control/Alt shortcuts (like Control-S in Word is save) becuase that's what I'm trying to accomplish.
VB Code:
Dim KeyAscii As String = Chr(e.KeyCode)
Thanks in advance,
Furry
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Oct 29th, 2002, 08:38 PM
#2
PowerPoster
Try this:
Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Dim keyVal As Char = Convert.ToChar(e.KeyCode)
If e.Control And keyVal = "S" Then
MessageBox.Show("Ctrl + S Pressed!")
End If
End Sub
-
Oct 29th, 2002, 08:42 PM
#3
this one would also work, I think
if e.keyData = (keys.shift or keys.s) then 'shift + s pressed
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 29th, 2002, 08:50 PM
#4
Frenzied Member
You can try this too 
VB Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If (Control.ModifierKeys And Keys.Control) = Keys.Control And e.KeyCode = Keys.S Then
MessageBox.Show("Pressed Control S")
End If
End Sub
Dont gain the world and lose your soul
-
Oct 30th, 2002, 01:30 PM
#5
Thread Starter
Addicted Member
Dang! We have an abundance of help around here! Thanks, guys! I got it twice - or was that three times? 
Furry
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
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
|