tabPage.Focus() doesn't work?

  • Thread starter Thread starter Torben Philippsen
  • Start date Start date
T

Torben Philippsen

Hi,

I have a TabControl in a WinForm witn two tabs.
At some point I want to switch focus from the first TabPage to the second
TabPage.

The documentation says that any control (which seems to be the case for the
TabControl) that derives from Panel aren't selectable.

Since I think this is a simple wish I can't imagine that there shouldn't be
a workaround for that. Do you have helping ideas?

Thank you very much.

Torben
 
Torben Philippsen said:
I have a TabControl in a WinForm witn two tabs.
At some point I want to switch focus from the first
TabPage to the second TabPage.

Do you want to select another tab? Simply set the 'SelectedTab' or
'SelectedIndex' property of the tabcontrol appropriately.
 
Hi,

I have a TabControl in a WinForm witn two tabs.
At some point I want to switch focus from the first TabPage to the
second TabPage.

The documentation says that any control (which seems to be the case
for the TabControl) that derives from Panel aren't selectable.

Since I think this is a simple wish I can't imagine that there
shouldn't be a workaround for that. Do you have helping ideas?

Thank you very much.

Torben

You can select the tab page:

tabControlMain.SelectedTab = tabPageContacts;

You can then set the focus to whichever control on the page you wish
(rather than the TabPage itself).

Is that what you need to do?
 
Do you want to select another tab?

Yes.


Simply set the 'SelectedTab' or
'SelectedIndex' property of the tabcontrol appropriately.

Thank you very much - to both of you. That was exactly what I've been
missing.

Best regards
Torben
 
Back
Top