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 › Removeing Certain Characters From a Textbox

Thumbs upRemoveing Certain Characters From a Textbox

Posts 1–9 of 9 · Page 1 of 1
Cryptonic
Cryptonic
Removeing Certain Characters From a Textbox
I'm trying to limit what the user can enter into a textbox. The easy part is knowing if they tried to type that character, the hard part is removing that single character. Does anyone know how? e.SuppressKeyPress is really buggy and not working right.

I've tried Textbox1.text.replace("|", "") and Textbox1.text.remove(Textbox1.textlength - 1), no luck there.
#1 · 13y ago
abuckau907
abuckau907
Silly question (..but without seeing the code), did you just call

Textbox1.text.replace("|", "")

or

TextBox1.Text = Textbox1.text.replace("|", "")

? Because strings are immutable, the first one won't work as you might expect.
#2 · edited 13y ago · 13y ago
DA
DawgiiStylz
Simple really
Code:
 Dim allowedChars As String = "abcdefghijklmnopqrstuvwxyz1234567890" & Chr(8) ' backspace
        If allowedChars.IndexOf(e.KeyChar) = -1 Then
            e.Handled = True
        End If
#3 · 13y ago
Cryptonic
Cryptonic
Quote Originally Posted by abuckau907 View Post
Silly question (..but without seeing the code), did you just call

Textbox1.text.replace("|", "")

or

TextBox1.Text = Textbox1.text.replace("|", "")

? Because strings are immutable, the first one won't work as you might expect.
Both of them still won't work.

Also, I'm using GetAsyncKeyState to see if the user presses the button.


---------- Post added at 11:26 AM ---------- Previous post was at 11:24 AM ----------

Quote Originally Posted by DawgiiStylz View Post
Simple really
Code:
 Dim allowedChars As String = "abcdefghijklmnopqrstuvwxyz1234567890" & Chr(8) ' backspace
        If allowedChars.IndexOf(e.KeyChar) = -1 Then
            e.Handled = True
        End If
It says the e.KeyChar is not a member, even though I have 'ByVal e As System.Windows.Forms.KeyEventArgs' included.
#4 · 13y ago
Jorndel
Jorndel
As you say, if you can capture (event) when user inputs, you can do a nooby remove

tb=textbox

tb.text.Remove(tb.text.length -1, 1)
tb.SelectionStart = tb.text.length


Or something along those lines.

What I do is:
I remove the LAST input char, and move the selection point to the end. (So the user won't start typing from the start )
#5 · 13y ago
Cryptonic
Cryptonic
Quote Originally Posted by Jorndel View Post
As you say, if you can capture (event) when user inputs, you can do a nooby remove

tb=textbox

tb.text.Remove(tb.text.length -1, 1)
tb.SelectionStart = tb.text.length


Or something along those lines.

What I do is:
I remove the LAST input char, and move the selection point to the end. (So the user won't start typing from the start )
That didn't remove the text though
#6 · 13y ago
Jorndel
Jorndel
Quote Originally Posted by PepsiXHacker View Post


That didn't remove the text though
Silly me

Forgot too do:

tb.Text = tb.Text.Remove(***)
'Else it's not assigning the new value as the content in the tb
#7 · 13y ago
abuckau907
abuckau907
"Also, I'm using GetAsyncKeyState to see if the user presses the button."

I assumed you were using one of the textbox_keypress_events..kind of an important detail : p
#8 · 13y ago
Cryptonic
Cryptonic
Quote Originally Posted by abuckau907 View Post
"Also, I'm using GetAsyncKeyState to see if the user presses the button."

I assumed you were using one of the textbox_keypress_events..kind of an important detail : p
Yes, it's fixed now. I was using the 'ByVal e As System.Windows.Forms.KeyEventArgs' and for some reason, was conflicting with the replace code...

Thanks for all your help

/solved
#9 · 13y ago
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

  • how do i remove taht arrow from shortcut icons?By thechewu in General
    1Last post 19y ago
  • Need Someone To Remove Ad's From Hack!By Justin in Combat Arms Help
    22Last post 16y ago
  • can any one remove the ads from this free vip hack so i can post on mpghBy kickthehacker in Combat Arms Discussions
    5Last post 16y ago
  • Remove all evidence from computerBy Tom in Exploits
    1Last post 16y ago
  • How do I remove the map from the zombie mod?By JukeBoxxHero in Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    1Last post 16y ago

Tags for this Thread

None