• home
  • forum
  • my
  • kt
  • download
  • Catch keypress events

    Author: 2007-09-06 10:43:41 From:

    attached file download attachment

    In this tutorial i will show you how you can catch keypress easly, without using hooks.

    Author: Geimas5
    Date: 6.nov.05
    difficulty: Easy
    Language: C# .net v2.0

    start of by making a windows application.

    now add the key down event to your form.

    do this by first clicking the eventlist button:

    the double click on the keyDown event:


    now you should be in the coding view

    now we will use the switch keyword to chose wich action that shall be taken.
    add this code:

                switch (e.KeyData)
                {
                    case Keys.B:
                        MessageBox.Show("You pressed B");
                        break;
                    case Keys.C:
                        MessageBox.Show("You pressed C");
                        break;
                }


    this will Display a messagebox then you press eather "B" or "C"

    i trust you understand this

    i hope this sums it up!!
    happy coding!!

    if you want to take a look at the finished project, just download the attachment.

    -Geimas5

    ?Made For Tutorial-suite.com only

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Basics (9)

    New

    Hot