tabPage.Focus() doesn't work?

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
 
H

Herfried K. Wagner [MVP]

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.
 
J

Jeff Gaines

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?
 
T

Torben Philippsen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top