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

  • SEARCH
  • Home
  • 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 8802003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:58:38+00:00 2026-06-14T00:58:38+00:00

I have a handle for a currency value. It should allow negative value say

  • 0

I have a handle for a currency value. It should allow negative value say -555.

On keydown/Keypress, when I try to find the Key value for Subtract key in Numpad, it gives me as Key.Subtract in IE versions. But in chrome/firefox latest versions, it shows me as Key.Unknown.

Is there any specific handle needs to be done.

Sample:

if ((e.Key >= Key.D0 && e.Key <= Key.D9) || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key == Key.Subtract) || (e.Key == Key.Unknown))
            {
                //valid number, but if shift is pressed, it is an invalied character
                if (Keyboard.Modifiers == ModifierKeys.Shift)
                    e.Handled = true;
            }            
            else
                e.Handled = true;

Here, I have handled the unknown key explicitly. But is there any standard way to get rid of this? Please help me.

  • 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-14T00:58:40+00:00Added an answer on June 14, 2026 at 12:58 am

    I have run into the same problem when some customers do not use IE. What you have to do is you have to check the value of PlatformKeyCode which has difference value on difference OS, for example, PlatformKeyCode of . is 190 on a Windows but it is 47 on Mac.

    Below statement quoted from KeyEventArgs.PlatformKeyCode Property on MSDN.

    The portable key codes are a common subset of all the possible key
    codes of the supported operating systems, in this case, Macintosh and
    Windows. For example, the keystroke ‘v’ is represented as a Key value
    (which would evaluate as 51 if you cast it to an integer, but is more
    useful if you retain the enumeration information). That key would have
    a PlatformKeyCode value of 86. Certain keystrokes, however, are not
    portable, such as the SCROLL LOCK key for Microsoft Windows. In this
    case, the Key value is Unknown, which is the value for any nonportable
    key, and the PlatformKeyCode is 145 on a Windows platform. For
    information about Microsoft Windows-specific key codes, see
    “Virtual-Key Codes” in the MSDN Library. For information on
    Macintosh-specific key codes, see Keyboard Layout Services Reference
    on the Apple Developer Connection Web site.

    On my machine the PlatformKeyCode value of - is 189.

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

Sidebar

Related Questions

In our business logic we have to handle positive and negative Double.Infinity values as
How should I handle text formatting in iOS? I'm not talking about Currency or
I have a UIViewController subclass that I am trying to have handle the shake
I have to handle some sensitive data in my application, such as passwords, credit
I have to handle the images uploaded by users and want to make thumbnails
just a general question, do you ALWAYS have to handle error? i was just
I'm working on a larger Web based Project, that probably will have to handle
I'm working on a mini windows process explorer in C, I have a handle
I have a file handle to a serial (COM) port. I need to read
I have a Window handle Picker and it says my handle is 0094167C. When

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.