Tab Contol Question

  • Thread starter Thread starter PosseJohn
  • Start date Start date
P

PosseJohn

I have a form that contains a Tab Control.

I would like to setfocus to a specific control on each tab when the tab is
activated, but can not find any event that provides this ability when the
tab is selected. I can only find "On Click", "On Dbl Click", "On Mouse
Down", "On Mouse Up", and "On Mouse Move" which applies to the entire tab
area itself, not just the tab name.

Am I outside of the box on this one?
 
PosseJohn said:
I have a form that contains a Tab Control.

I would like to setfocus to a specific control on each tab when the tab is
activated, but can not find any event that provides this ability when the
tab is selected. I can only find "On Click", "On Dbl Click", "On Mouse
Down", "On Mouse Up", and "On Mouse Move" which applies to the entire tab
area itself, not just the tab name.


Use the tab control's Change event.
 
Am I outside of the box on this one?

Nope, but you should be :-)

It sounds like you're selecting the tab Pages themselves (will have a tab
order, etc if you right click). What you need is the tab Control.

When you select the tab Page, you see the little black selector boxes inside
the tab control, and generally around the controls on them. Click on the
outermost corner of the control (above the tabs themselves), and you should
see those little black boxes, well... outside the box. This is the control
itself, which has a Change event, which I think is what you need...

Private Sub TabControl_Change()
If Me.TabControl = 0 Then
'first tab
Me.SomeControlOnFirstTab.Setfocus
Elseif Me.TabControl = 1
'second tab
Me.SomeControlOnSecondTab.SetFocus
End If
End Sub


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Back
Top