0
Answer

Help me

Photo of Nofc Janas

Nofc Janas

16y
2k
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);
        }

 

Answers (0)