VB.net open form when character is typed into text box


I have a text box where I want the user to have options available when they type a certain character eh #
Is it possible trigger code when a single character is typed in VB.net. Essentially I want to mimic intellisense
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
you can try something tracing the KeyPress or KeyDown event, example:

private void txtContent_KeyPress(object sender, KeyPressEventArgs e)
            if (e.KeyChar.ToString() == "#")

        private void yourOption(KeyPressEventArgs e)
            MessageBox.Show(e.KeyChar.ToString() + " was pressed");

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
Jacques Bourgeois (James Burger)PresidentCommented:
Be aware that KeyDown might not give you what you want. KeyDown identifies the physical key that is pressed on the keyboard, not the character that goes to the screen.

Take the key that gives a "/" on an English keyboard. That same key gives a "é" on some French keyboards. No matter if the keyboard is configured for French or English, KeyDown will identify it as key 191, but KeyPress will make the difference between "/" and "é".

When you need to check the character that goes to the screen, KeyDown is not the thing to use, always use KeyPress.

KeyDown is interesting only when you want to trap keys that do not generate a character to the screen, such as F1 or Del.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.