Tab Control problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use Event Procedure when pressing specific page tab on the form.
Page exposes events: click, dblclick, etc. I put MsgBox “OK†into click event
procedure code, but that event is not fired when clicking on page tab, why?
Tab control event procedure works: it fires when click on tab Control. But
tab control is not activated automatically when pressing on specific page
tab.
So, how to activate event procedure when clicking on page tab?
Thanks in advance for help
 
Ilya said:
I want to use Event Procedure when pressing specific page tab on the
form. Page exposes events: click, dblclick, etc. I put MsgBox "OK"
into click event procedure code, but that event is not fired when
clicking on page tab, why? Tab control event procedure works: it
fires when click on tab Control. But tab control is not activated
automatically when pressing on specific page tab.
So, how to activate event procedure when clicking on page tab?
Thanks in advance for help

Use the Change event of the entire TabControl and in your code determine which
page was selected by testing the value property of the TabControl (0 = page1, 1
= page2, etc.).
 
That is the problem:how to fire Tab Control Event? The user switches the page
of the form by pressing page tab, not tab control. How to activate tab
control each time page is activated.
 
Ilya said:
That is the problem:how to fire Tab Control Event? The user switches
the page of the form by pressing page tab, not tab control. How to
activate tab control each time page is activated.

When they change pages the Change event of the control fires.
 
There appears to be a native On Click event for each tab, does this not work?

The Click event is pretty useless: it responds to a mouseclick *on the
face of the tab page*.

The event to detect the user selecting a tab is the Tab Control's
Change event.

John W. Vinson[MVP]
 
T
Thanks John

and would we use the control change event like;

If Me.ctrlTabControl.Pages.Count = 1 Then
DoSomething (when 2nd tab is clicked)
End If

??


glenn52
 
T
Thanks John

and would we use the control change event like;

If Me.ctrlTabControl.Pages.Count = 1 Then
DoSomething (when 2nd tab is clicked)
End If

Well... not especially.

Private Sub ctrlTabControl_Change()
Select Case ctrlTabControl.Value ' which page was selected
Case 0 ' first page, it's the zero-based Index property of the tab
<do something>
Case 1 ' second page
<do something else>
...
End Select


John W. Vinson[MVP]
 
John Vinson said:
Well... not especially.

Private Sub ctrlTabControl_Change()
Select Case ctrlTabControl.Value ' which page was selected
Case 0 ' first page, it's the zero-based Index property of the tab
<do something>
Case 1 ' second page
<do something else>
...
End Select


John W. Vinson[MVP]
hi
The above has been very helpful to me - so thanks , however, is it
possible to change the fontweight of the page caption to bold etc -
Everytime I try to do this I get error message

Thank you

Robert
 
Back
Top