Nofc Janas

Nofc Janas

  • NA
  • 1
  • 0

Help me

Apr 6 2009 11:32 PM

We know that in winform,we can use "Tab" key to move focus,and now I want to move focus when I pressed "Enter" key in C# code project, I had added this code section in my form source,but it doesn't work sometimes.How can I do?


        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            if (keyData == Keys.Enter)
            {
                SendKeys.Send("{TAB}");
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }