none
Button acting as Key RRS feed

  • Question

  • Hi,

    I am developing a keyboard for using C#. I want to know how can I make the Backspace button invoke a Backspace, Delete button invoke a Delete, etc...

    Tuesday, June 11, 2013 3:40 PM

Answers

All replies

  • Jassim : 

    Are you leveraging windows forms or WPF ?

    if windows forms did you try key up event ?

       private void Form1_KeyUp(object sender, KeyEventArgs e)
            {
                if (e.KeyCode.ToString().ToUpper().Equals("BACK"))
                {
                    //back space key
                    MessageBox.Show("BACK SPACE");
                }
                if (e.KeyCode.ToString().ToUpper().Equals("DELETE"))
                {
                    //delete key
                    MessageBox.Show("DELETED");
                }
            }

    Tuesday, June 11, 2013 4:22 PM
  • not like this.

    I have a btnDelete and btnBackspace and if user clicked on the button then the btnBackspace_Click or btnDelete _Click should invoke the Backspace and Delete keys.

    Tuesday, June 11, 2013 8:43 PM
  • See if the example at bottom of this page answers your question?

    http://www.xtremedotnettalk.com/showthread.php?t=91435

    Tuesday, June 11, 2013 9:04 PM
  • SendKeys.Send("{DELETE}");

    and

    SendKeys.Send("{BACKSPACE}");

    • Marked as answer by Jassim Rahma Tuesday, June 11, 2013 9:10 PM
    Tuesday, June 11, 2013 9:09 PM