Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Help]Quick Simple Fast Question[Solved]

[Help]Quick Simple Fast Question[Solved]

Posts 1–13 of 13 · Page 1 of 1
LY
Lyoto Machida
[Help]Quick Simple Fast Question[Solved]
How do i get the pressed key?

I did this:
Code:
    Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Form1.KeyPress
        Dim PressedKey As String = Asc(e.KeyChar)
        Label1.Text = PressedKey
    End Sub
But i want to get F5 and that keys..
#1 · edited 15y ago · 15y ago
Jason
Jason
Try this:

Code:
Label1.Text = e.KeyChar.ToString
#2 · 15y ago
LY
Lyoto Machida
Quote Originally Posted by Jason View Post
Try this:

Code:
Label1.Text = e.KeyChar.ToString
Works like my code...


But i want to get the FX Keys .. Like F5 F6 etc..

I need to GetAsyncKeyState?
#3 · 15y ago
Jason
Jason
Handle the keydown then:

Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    Label1.Text = CType(e.KeyCode, Keys).ToString
End Sub
#4 · 15y ago
LY
Lyoto Machida
Quote Originally Posted by Jason View Post
Handle the keydown then:

Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    Label1.Text = CType(e.KeyCode, Keys).ToString
End Sub
WOW , Thanks man.

You pro!

/SOLVED
#5 · 15y ago
♪~ ᕕ(ᐛ)ᕗ
♪~ ᕕ(ᐛ)ᕗ
Quote Originally Posted by Jason View Post
Handle the keydown then:

Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    Label1.Text = CType(e.KeyCode, Keys).ToString
End Sub
if I can make you a question....Why call the CType function?
#6 · 15y ago
Jason
Jason
Quote Originally Posted by 3Li0 View Post
if I can make you a question....Why call the CType function?
"Keys" is an enum. So basically what I did was convert the integer represented in "e.KeyCode" to it's counterpart in the enum (the one with the same value as the integer) then called ".ToString" to convert this into a string. For example, say I have an enum like this:

Code:
Enum Test
  Test1 = 1
  Test2 = 2
  Test3 = 69
End Enum


And I have the integer 69, so I want to get the string "Test3" from the enum.

Code:
CType(69, Test).ToString


I convert 69 to it's counterpart in the Enum (i.e the Test3 block) then call ".ToString" to get the name of the block ("Test3")
#7 · 15y ago
♪~ ᕕ(ᐛ)ᕗ
♪~ ᕕ(ᐛ)ᕗ
Quote Originally Posted by Jason View Post


"Keys" is an enum. So basically what I did was convert the integer represented in "e.KeyCode" to it's counterpart in the enum (the one with the same value as the integer) then called ".ToString" to convert this into a string. For example, say I have an enum like this:

Code:
Enum Test
  Test1 = 1
  Test2 = 2
  Test3 = 69
End Enum


And I have the integer 69, so I want to get the string "Test3" from the enum.

Code:
CType(69, Test).ToString


I convert 69 to it's counterpart in the Enum (i.e the Test3 block) then call ".ToString" to get the name of the block ("Test3")
oh yea, so basically you simply converted the Integer of the key in the enum to a string value...
I did understand thanks....oh and an other function, can we convert it using DirectCast for ie?
#8 · 15y ago
Jason
Jason
Quote Originally Posted by 3Li0 View Post
oh yea, so basically you simply converted the Integer of the key in the enum to a string value...
I did understand thanks....oh and an other function, can we convert it using DirectCast for ie?
Yeah DirectCast is similar to CType however it has become obsolete and CType is favored over it.

EDIT: 2700th post. Yay?
#9 · 15y ago
♪~ ᕕ(ᐛ)ᕗ
♪~ ᕕ(ᐛ)ᕗ
Quote Originally Posted by Jason View Post


Yeah DirectCast is similar to CType however it has become obsolete and CType is favored over it.

EDIT: 2700th post. Yay?
thx again for answering my questions, ure great!

P.S.
GJ on 2,700!
#10 · 15y ago
NextGen1
NextGen1
Plus, DirectCast has been obsolete for awhile, it's only a matter of time before it is completely removed form the framework, meaning somewhere download the line, apps using directcast will fail.

Stick to ctype.
#11 · 15y ago
Jason
Jason
Quote Originally Posted by NextGen1 View Post
Plus, DirectCast has been obsolete for awhile, it's only a matter of time before it is completely removed form the framework, meaning somewhere download the line, apps using directcast will fail.

Stick to ctype.
I know I'm not supposed to post now, but who was having a little hissy fit about DirectCast being obsolete 2 days ago Rich? So much for kicking it oldschool.
#12 · 15y ago
NextGen1
NextGen1
I do hate the fact that it is obsolete, so much of my past applications use direccast over Ctype, so eventually there may be a lot of failing apps.

But, Still sharing the truth, it is Obsolete
#13 · 15y ago
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Tags for this Thread

None