0
Answer

Help me

Nofc Janas

Nofc Janas

15y
1.7k
1

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);
        }