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 6683493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:49:40+00:00 2026-05-26T04:49:40+00:00

A program I’ve written that normally works well is now freaking out about Keys.D1

  • 0

A program I’ve written that normally works well is now freaking out about Keys.D1 having a value of "LButton | ShiftKey | Space"

Here’s a screen grab of the problem:
enter image description here

ModifierKeys is an enum with the following definition:

public enum ModifierKeys : uint
{
    Alt = 1,
    Control = 2,
    Shift = 4,
    Win = 8
}

What on earth is going on here? There are no other references to Keys.D1.

  • 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-05-26T04:49:41+00:00Added an answer on May 26, 2026 at 4:49 am

    Quoting from Keys Enumeration:

    Caution
    Do not use the values in this enumeration for combined bitwise operations. The values in the enumeration are not mutually exclusive.

    Although the System.Windows.Forms.Keys enumeration has the [Flags] attribute, the only flags that can actually be safely used as flags are:

    • Keys.Shift
    • Keys.Ctrl
    • Keys.Alt

    All the remaining values are not “flags” enumeration values. As a result, some combinations of values that are not “flags” values coincidentally happen to combine to form other values that are not “flags” values.

    The effect your are seeing is the Enum.ToString() operator misusing the [Flags] attribute to construct such combinations. This is harmless because the ShiftKey and the Space key are never intended to be combined, per the documentation above.

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

Sidebar

Related Questions

class Program { static void Main(string[] args) { string value = "12345"; Type enumType
My program generates relatively simple PDF documents on request, but I'm having trouble with
The program that I am currently assigned to has a requirement that I copy
A program that I work on assumes that the UUID generated by the Windows
My program has to read files that use various encodings. They may be ANSI,
My program is a game that uses RMI to allow users to connect to
The program that I am working on takes a file and parses it line
Program A, is a c program that endlessly, receives input in stdin, process it
/* Program that reads a sequence of words from keyboard and prints the list
Program works fine (with random crashes) and Memory Validator reports Uninitialized read problem in

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.