Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Not quite sure what "is equal to" actually means...

Not quite sure what "is equal to" actually means...

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpdatabasegame-devhelpquestion
11 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #1

    From our own C# forum again:

    Hi!

    In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
    pressed as well as the space key.

    I'm using this code in the form to receive the keyboard inputs:

    protected override void OnKeyDown(KeyEventArgs e)
    {
    base.OnKeyDown(e);
    if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
    MessageBox.Show("UP & SPACE");
    }

    Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

    How shall I solve this problem?

    Um - what do they teach them? And why?

    No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    K C M F T 6 Replies Last reply
    0
    • OriginalGriffO OriginalGriff

      From our own C# forum again:

      Hi!

      In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
      pressed as well as the space key.

      I'm using this code in the form to receive the keyboard inputs:

      protected override void OnKeyDown(KeyEventArgs e)
      {
      base.OnKeyDown(e);
      if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
      MessageBox.Show("UP & SPACE");
      }

      Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

      How shall I solve this problem?

      Um - what do they teach them? And why?

      No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      :laugh:

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        From our own C# forum again:

        Hi!

        In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
        pressed as well as the space key.

        I'm using this code in the form to receive the keyboard inputs:

        protected override void OnKeyDown(KeyEventArgs e)
        {
        base.OnKeyDown(e);
        if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
        MessageBox.Show("UP & SPACE");
        }

        Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

        How shall I solve this problem?

        Um - what do they teach them? And why?

        No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        The answer's in the code. UP in SPACE is where the coder seems to be. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          From our own C# forum again:

          Hi!

          In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
          pressed as well as the space key.

          I'm using this code in the form to receive the keyboard inputs:

          protected override void OnKeyDown(KeyEventArgs e)
          {
          base.OnKeyDown(e);
          if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
          MessageBox.Show("UP & SPACE");
          }

          Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

          How shall I solve this problem?

          Um - what do they teach them? And why?

          No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

          M Offline
          M Offline
          MadProgrammer76
          wrote on last edited by
          #4

          [Message Deleted]

          OriginalGriffO J 2 Replies Last reply
          0
          • M MadProgrammer76

            [Message Deleted]

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            No, this was originaly posted in the C# forum by Mc_Topaz and I copied it here as an example of "why the hell did you do that and then ask why it doesn't work?". Hence the "From our own C# forum" and "What do they teach them" bits.

            No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • M MadProgrammer76

              [Message Deleted]

              J Offline
              J Offline
              J4amieC
              wrote on last edited by
              #6

              Andrew Pallant wrote:

              I am not one to usually say anything about posting in the wrong forum, but you really did this time.

              Did you actually read the post? The OP didn't post a programming question at all, he's pointing out a very misguided bit of code posted by someone else.

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                From our own C# forum again:

                Hi!

                In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
                pressed as well as the space key.

                I'm using this code in the form to receive the keyboard inputs:

                protected override void OnKeyDown(KeyEventArgs e)
                {
                base.OnKeyDown(e);
                if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
                MessageBox.Show("UP & SPACE");
                }

                Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

                How shall I solve this problem?

                Um - what do they teach them? And why?

                No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                F Offline
                F Offline
                Fatbuddha 1
                wrote on last edited by
                #7

                I wonder if one can actually press the keys fast enough, without keeping the other one pressed :laugh: Nice one. Cheers

                You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)

                1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  From our own C# forum again:

                  Hi!

                  In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
                  pressed as well as the space key.

                  I'm using this code in the form to receive the keyboard inputs:

                  protected override void OnKeyDown(KeyEventArgs e)
                  {
                  base.OnKeyDown(e);
                  if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
                  MessageBox.Show("UP & SPACE");
                  }

                  Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

                  How shall I solve this problem?

                  Um - what do they teach them? And why?

                  No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                  T Offline
                  T Offline
                  TheNexpert
                  wrote on last edited by
                  #8

                  LOL - suggest him to save the last pressed key. If the currently pressed key is space und the last key was keyup or vice versa then his condition is fulfilled.

                  1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    From our own C# forum again:

                    Hi!

                    In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are
                    pressed as well as the space key.

                    I'm using this code in the form to receive the keyboard inputs:

                    protected override void OnKeyDown(KeyEventArgs e)
                    {
                    base.OnKeyDown(e);
                    if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
                    MessageBox.Show("UP & SPACE");
                    }

                    Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.

                    How shall I solve this problem?

                    Um - what do they teach them? And why?

                    No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                    P Offline
                    P Offline
                    puromtec1
                    wrote on last edited by
                    #9

                    First, this person seems to be in school and is currently learning programming. Next, this posting IS appropriate for the C# forum. This person's folly is obviously their lack of paying attention to the precise nature of all pieces of the code (ie. KeyCode cannot equal to different things). They are thinking of the "if" statement as a perverse non-procedural construct, similar to an SQL "select" statement. However, the imagination displayed here is in the spirit of a real programming concept: bit mask.

                    M 1 Reply Last reply
                    0
                    • P puromtec1

                      First, this person seems to be in school and is currently learning programming. Next, this posting IS appropriate for the C# forum. This person's folly is obviously their lack of paying attention to the precise nature of all pieces of the code (ie. KeyCode cannot equal to different things). They are thinking of the "if" statement as a perverse non-procedural construct, similar to an SQL "select" statement. However, the imagination displayed here is in the spirit of a real programming concept: bit mask.

                      M Offline
                      M Offline
                      Megidolaon
                      wrote on last edited by
                      #10

                      No, his folly was to post the question here. I don't know if he has ADS or something, but the red warning of not posting programming questions here is hard to overlook. I always marvel anew at those that don't even spend 0.2 seconds to verify if the place they ask a programming question is even remotely right. Maybe we should redirect them to some forum about cats next time, it's certainly not a wronger place to ask.

                      P 1 Reply Last reply
                      0
                      • M Megidolaon

                        No, his folly was to post the question here. I don't know if he has ADS or something, but the red warning of not posting programming questions here is hard to overlook. I always marvel anew at those that don't even spend 0.2 seconds to verify if the place they ask a programming question is even remotely right. Maybe we should redirect them to some forum about cats next time, it's certainly not a wronger place to ask.

                        P Offline
                        P Offline
                        puromtec1
                        wrote on last edited by
                        #11

                        You might not have seen the post before it was deleted. Why it was? I don't know. The fellow wrote ABOUT a question in the c# forum (NOT THIS ONE). There were no rules broken on posting procedure.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups