Mobile Problem Solutions ,Softwares,Questions and Answers ,Errors Solutions and so More

>

Breaking

Monday, 19 February 2018

Press Enter to move to next control IN c#

Move to next textbox when Enter key is pressed


Its Simple

follow this code..
Paste this code in KeyUp event of Your Control


if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
            {
                this.SelectNextControl((Control)sender, true, true, true, true);
            }




Example..

 private void txtcodefrom_KeyUp(object sender, KeyEventArgs e)
        {

            if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
            {
                this.SelectNextControl((Control)sender, true, true, true, true);
            }
        }




OTHER WAY.

  private void txtTAX_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{TAB}");
                e.Handled = true;
                e.SuppressKeyPress = true;
            }

        }

No comments:

Post a Comment