Tab Control on a From

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

Guest

I have a Tab Control with multiple pages on a form. I am trying to make 2
controls on the form invisible when a particular page within the tab control
is clicked. I have set the following in the OnClick event to the page within
the tabl control to no avail.

Private Sub Page315_Click()
Me.Command96.Visible = False
Me.Command98.Visible = False
End Sub

In fact no matter what code is included for the on click event of the pages
it just doesn't seem to acknowledge it.

Any help will be appreciated...

Thanks,

ET
 
ETSherman said:
I have a Tab Control with multiple pages on a form. I am trying to make 2
controls on the form invisible when a particular page within the tab control
is clicked. I have set the following in the OnClick event to the page within
the tabl control to no avail.

Private Sub Page315_Click()
Me.Command96.Visible = False
Me.Command98.Visible = False
End Sub

In fact no matter what code is included for the on click event of the pages
it just doesn't seem to acknowledge it.

Any help will be appreciated...

The Click event of a TabPage is misnamed (IMO) and largely useless. It
does NOT fire when you click on the small "tab" of the page, but rather
when you click on any unoccupied real estate of the page that is already on
top.

What you need is the Change event of the entire TabControl. In that event
you can test the Value property of the TabControl to determine which page
was just selected and run page-specific code that way. The Value property
will correspond to the page index property of the selected page.
 
Many thanks Rick ......

That worked and is exactly what I was looking for. It's strange that the On
Click event of the Page does not do the same.

Oh well, your suggestion worked.

Again,

Thanks

ET
 
Back
Top