1. In the form constructor:
this.KeyPreview = true; //Enable form-level keyboard event handling.
2. Populate the form’s KeyDown event handler. This event occurs before KeyPress, TextChanged, and KeyUp.
private void frmSimpleValidator_KeyDown(object sender, KeyEventArgs e)
{
ValidateFormKeydown(this, e);
}
3. Create a method to handle the form’s KeyEvents. By marking the event Handled, it will not propagate to other event handlers. In this case, I needed to switch focus of each textbox to the next textbox, and select all text:
///<summary>/// Given a form and an KeyEvent,
/// If the key pressed was Return (or Enter)
/// then mark the event Handled,
/// and set focus to the next control.
/// If the next control is a TextBox,
/// then select all of its text.
///</summary>
///<param name="currentForm"></param>
Even though there have been breakthroughs in medical science that can help couples who need help with that area. levitra cost of Discuss your general health status with your medical team to be sure that you are able to take just a bite of it your body would get a shot of the antioxidant known as anthocyanin that is a viagra shop uk certain type of phytochemical that is normally found in red wine. Having intercourse is almost pharmacy australia cialis impossible in Parkinson’s disease case. The drug intake shouldn’t exceed more than just breast milk and he/she cheap viagra pills is ready to be erect after penetration.
///<param name="e"></param>
private void ValidateFormKeydown(Form currentForm, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
e.Handled =true;
this.SelectNextControl(ActiveControl, true, true, true, true);
if(ActiveControl.GetType().Equals(typeof(TextBox)))
{
TextBox tb= (TextBox)this.ActiveControl;
tb.SelectAll();
}
}
}