Create Hot-Key for submitting from C# Windows App

  • Thread starter mikemiller.innova
  • Start date
M

mikemiller.innova

I created a simple C# Windows Application that allows Users to type
comments and then click a 'Submit' button to sumit the entry and close
the application.

How can I create a Hot-Key like Ctrl-Enter that will do the same thing
as clicking the 'Submit' button?
 
C

ClayB

If you are using a TextBox to allow the user to enter text, you could
try handling the KeyDown event and catching the ctl+Enter there.

void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.Enter)
{
submitButton.PerformClick();
e.Handled = true;
}
}
======================
Clay Burch
Syncfusion, Inc.
 
O

Otis Mukinfus

I created a simple C# Windows Application that allows Users to type
comments and then click a 'Submit' button to sumit the entry and close
the application.

How can I create a Hot-Key like Ctrl-Enter that will do the same thing
as clicking the 'Submit' button?

Set the text on the button to &Submit. That will put an underscore under the
character S. Then when the user enters ALT-S the button will be clicked.

Good luck with your project,

Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
http://www.n5ge.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top