How do I bind a TAB key to a custom control so that focus does not go to another control?

I have a usercontrol that is meant to fill out an entire form. I want my usercontrol to handle the TAB key press and do something, rather than focusing the TAB on another control on the form. I am handling the KeyDown event in my usercontrol, but it doesn't fire when the TAB key is pressed.

+1


source to share


1 answer


        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (keyData != Keys.Tab)
            {
              return base.ProcessDialogKey(keyData);
            }
            return false;
        }

      



+3


source







All Articles