WinForm - TabStop Not Working

北城余情 提交于 2019-12-06 03:00:17

The MSDN documentation for RadioButton.TabStop states "This API supports the .NET Framework infrastructure and is not intended to be used directly from your code". Which basically means, "This isn't going to work how you expect it to".

With that said, the Enter event will fire when the button receives the focus. You can try to use that to move focus to another control.

Setting the TabStop to False on a RadioButton to prevent tabbing to the control works until you actully select the radio button without any additional overrides like suggested by @msergeant.

EDIT

The following code prevents the code from getting a tab key event:

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
   radioButton1.TabStop = false;
}

Radio buttons behave differently with respect to Tab from other controls in that they work in sets or groups based on setting the tab index or placing then radio buttons in a group box.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!