[CODE] Button Pressed[Solved]

Posts 1–15 of 17 · Page 1 of 2
[CODE] Button Pressed[Solved]
Complete this:

Label1.text = ( whatever button i just pressed ) ?

Eg, if i pressed F6, The label text would be " F6 "
Quote Originally Posted by 'Bruno View Post
this topic on the very first page of VB section.. why asking again dude?

Visual Basics - MPGH - MultiPlayer Game Hacking
No.. If you read the topic, thats not what im looking for
i need the Label text to be whatever button i pressed..
So if i pressed " W "
the label text would be " W "
and if i pressed " T "
the label text would be " T "
Get it?
Quote Originally Posted by Golden. View Post
No.. If you read the topic, thats not what im looking for
i need the Label text to be whatever button i pressed..
So if i pressed " W "
the label text would be " W "
and if i pressed " T "
the label text would be " T "
Get it?
yes i do, and it the same... if you dont want to focus..

otherwise just use the keypress event on the label.. :\
I need a code..I Am a complete newb. :P
Quote Originally Posted by Golden. View Post
I need a code..I Am a complete newb. :P
YouTube - Broadcast Yourself.ⓘ you'll get code for sure, its pretty long/yea
learn hotkeys then'll be easy there's lot of TUTs
dude.. its all about events... you should really try to do it yourself.. Search around MSDN for returns and use intellisense to find functions, proprieties.. etc.
OMG!
I KNOW HOW DO HOTKEYS, THATS NOT WHAT IM LOOKING FOR!!!!!!
Right
When you are making the settings for a game
it will say

Shoot : [ Left Mouse ]

Then you click it

Shoot : [ ]

Then you put what you want the shoot button to be

Shoot : [ F Key ]

It detects which key you just pressed..
I Want a label to detect which key i pressed and then tell me.
.......Ok, watch the rage.

Next on the list, what everyone is saying is correct, You just not getting it.

But....there is an easier way

really all you want to do is use keydown (keeping in mind that in the Keydown Event
e = System.Windows.Forms.KeyEvenArgs (KeyEvents)

Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyEventArgs) Handles
MyBase.KeyDown

If e.KeyCode = 37 Then 
label1.text = "cursor left"
end if

If e.KeyCode = 39 Then ' Cursor right
label1.text = "cursor right"
end if

End Sub
go online and look up the "Key
Enumeration" list.

----
e.Key = Key.Return etc.


[php]If getasynckeystate(keys.f6) then
label1.text = "F6"
End if[/php]

I just did that for 240 keys not gonna give you though, it takes some time. I don't support copy & paste. You better use select case though.

We do know what you want and with the information given above you can figure it out.

Or you convert the key pressed to string, google for a method.
Problem is, i am doing this becuase i bought a USB game controller off ebay, i need to make sure the buttons work, and the buttons are called Button1, Button 2, that kind of thing..
Just go into a game and check it out x.x
Quote Originally Posted by Blubb1337 View Post
Just go into a game and check it out x.x
or..
Control Panel > Game Controllers > Properties > TEST
Posts 1–15 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?