Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8486001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:48:44+00:00 2026-06-10T20:48:44+00:00

I have a method that I call when a the KeyUp event fires on

  • 0

I have a method that I call when a the KeyUp event fires on my control and within that method I check the key pressed is a letter or digit using the char.IsLetterOrDigit method. However it doesn’t seem to work with the KeyPad numbers!?

My code is below:

    void MyControls_KeyUp(object sender, KeyEventArgs e)
    {
        if ((char.IsLetterOrDigit(Convert.ToChar(e.KeyValue))))
        {
            ....
        }
    }

Anybody any ideas why this doesn’t work?

Thanks in advance.

I’m using C#4.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:48:46+00:00Added an answer on June 10, 2026 at 8:48 pm

    You’re not doing what you think you’re doing.

    Convert.ToChar() isn’t going to take a keyboard code and turn it into the character that that key represents; there’s too much involved in doing this, what with different keyboard layouts, cultures, key modifier states, and so on. What you’re doing here is taking the numeric value of the KeyCode enumeration and casting it to char.

    If you want to retrieve the character associated with a key press, you need to override the KeyPress event rather than the KeyUp event. Windows Forms will do all of the necessary translation and conversion in order to determine which character corresponds to the key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ajax method that fires on the keyup event, but I don't
I have a method that I call to make web service requests using GET.
I have a method that I call and it returns bitmap data from a
Say I have a method that I wish to call which has an argument
I have several models that need to call a method that takes a particular
I have a method which I am trying to call dynamically. That method has
Let's say I have a subroutine/method that a user can call to test some
I need to implement a call to a method that I have in my
I have a function that needs to call a virtual method many times in
I'm attempting to build a method call from strings that have been passed into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.