bender
bender

Reputation: 673

Let UserControl have focus inside a TabPage

I have a Windows Forms application with a TabControl with several TabPages where each TabPage contains my own class FooControl that extends UserControl. What I need is the FooControl class to receive KeyDown/Up events, but the problem is that it never receives focus automatically. The focus seems to remain on the TabControl somehow, and even if I explicitly set the focus with UserControl.Focus() it will not always work (well sometimes is does work, but the focus will go away again).

I'm wondering if I missed something or if it's simply not possible to let the FooControl class receive key events?

Upvotes: 1

Views: 45

Answers (1)

MrB3NiT0
MrB3NiT0

Reputation: 147

If you want set focus where you want be careful to set all your control TabIndex properties to 0 and TabStop to false and if all your control have these properties set so you can focus what you want. Hope It's help you.

Upvotes: 0

Related Questions