With the help of a tutorial, I have coded the following event:
Expand|Select|Wrap|Line Numbers
- private void ReturnResults(object o, KeyPressEventArgs e)
- {
- char c = e.KeyChar;
- if (c == (char) Keys.Return)
- {
- SearchAdmin();
- }
- else
- {
- e.Handled = false;
- }
- base.ProcessDialogKey(Keys.Return);
- }
Expand|Select|Wrap|Line Numbers
- this.KeyPress += new KeyPressEventHandler(ReturnResults);
- //this.ProcessDialogKey += new KeyPressEventHandler(ReturnResults);
Unfortunately, nothing happens when I press return with the code as it stands. And, when I first tried implementing it, the form would EXIT when return was pressed, but I don't know how that would have happened?
Am I missing something? Please advise.
Matt