Apr 12th, 2008, 01:28 AM
#1
Thread Starter
Lively Member
[2005][Resolved] trouble with keys.oem(number)
I'm having trouble getting vb to recognize that a number key across the top of the keyboard is being pressed. I think that those keys are Oem1-9.
this is my code:
vb Code:
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
Select Case e.KeyCode
Case Is = Keys.A
Pic1Move3.Enabled = False
Case Is = Keys.S
Pic1Move2.Enabled = False
Case Is = Keys.D
Pic1Move1.Enabled = False
Case Is = Keys.W
Pic1Move0.Enabled = False
Case Is = Keys.Up
Pic2Move0.Enabled = False
Case Is = Keys.Right
Pic2Move1.Enabled = False
Case Is = Keys.Down
Pic2Move2.Enabled = False
Case Is = Keys.Left
Pic2Move3.Enabled = False
Case Is = Keys.Oem1
Select Case P1Spells(1)
Case Is = "Fireball"
P1CurrentSpell.BackgroundImage = Image.FromFile("Fireball Icon.png")
End Select
Case Is = Keys.Oem2
Select Case P1Spells(2)
Case Is = "Fireball"
P1CurrentSpell.BackgroundImage = Image.FromFile("Fireball Icon.png")
End Select
Case Is = Keys.Oem3
Select Case P1Spells(3)
Case Is = "Fireball"
P1CurrentSpell.BackgroundImage = Image.FromFile("Fireball Icon.png")
End Select
Case Is = Keys.Oem4
Select Case P1Spells(4)
Case Is = "Fireball"
P1CurrentSpell.BackgroundImage = Image.FromFile("Fireball Icon.png")
End Select
Case Is = Keys.Oem5
Select Case P1Spells(5)
Case Is = "Fireball"
P1CurrentSpell.BackgroundImage = Image.FromFile("Fireball Icon.png")
End Select
Case Is = Keys.Q
P1CurrentSpell.BackgroundImage = Nothing
End Select
End Sub
the code works if i use any other key (like the numpad), just not with Oem. It doesnt give me an error, it just does nothing when i press the number keys.
anyone got a reason why?
Thanks.
Last edited by squrrilslayer; Apr 12th, 2008 at 02:48 AM .
Apr 12th, 2008, 02:29 AM
#2
Re: [2005] trouble with keys.oem(number)
If you want to know what they are you simply need to handle the KeyUp event, press one of those keys and test the value of e.KeyCode:
Code:
Private Sub Form1_KeyUp(ByVal sender As Object, _
ByVal e As KeyEventArgs) Handles Me.KeyUp
MessageBox.Show(e.KeyCode.ToString())
End Sub
When you do that you'll find that you're looking for the wrong values.
Apr 12th, 2008, 02:43 AM
#3
Thread Starter
Lively Member
Re: [2005] trouble with keys.oem(number)
thanks for that tip. Im not home however at the moment, what are the number keys across the top of the keyboard called?
picture attached with number keys highlighted.
Attached Images
Apr 12th, 2008, 02:45 AM
#4
Re: [2005] trouble with keys.oem(number)
Apr 12th, 2008, 02:47 AM
#5
Thread Starter
Lively Member
Re: [2005] trouble with keys.oem(number)
oh really?!
i saw that... but.... gah...
Thanks for the help!
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