Oh yes sorry, far easier is to put in the button eventhandler
if(!this.textBox1.Focused)
{
RunYourRoutine();
}
else
{
//// do something else
}
Although if you have lots of these types of textbox you may want to consider
a different solution, is this ASP.NET?
"Steve Murphy" <sm*****@granite-ridge.com> wrote in message
news:Od****************@TK2MSFTNGP12.phx.gbl...
"Uchiha Jax" <i_************************@NOSPAMhotmail.com> wrote:
You could use the KeyUp or KeyDown event handler on the textbox and
check the KeyEventArgs.KeyCode property agains the Keys enumerable Keys.Enter.
e.g
Thanks. This works only in the KeyUp event. Do you have any thoughts on
why? Not that it's important; I'm just curious.
Also, however, this does not filter the event, and the default button
event still runs.
Thanks,
Steve Murphy