referring to a particular tab on a tab control

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

Guest

I have a tabControl on frmForm. When the user selects a particular tab (e.g.
Tab2) I would like to run a procedure. I can activate a procedure when the
user clicks on the tab control using: private sub TabControl_Change(). But
how do I evaluate which tab was selected (for example)
private sub TabControl_Change()
if me.TabControl = "Tab2" Then
Beep
End if
End Sub
I tried this but it doesn't work. Any help would be appreciated. Thanks.
 
What you're calling "Tab2" is actually the name of a Page object in the Tab
control's Pages collection.

The Tab control's Value property tells you what page is current.

What you likely want, then, is:
 
Sorry about that: hit Enter too soon!

What you're calling "Tab2" is actually the name of a Page object in the Tab
control's Pages collection.

The Tab control's Value property tells you what page is current.

What you likely want, then, is:

If Me.TabControl.Pages(Me.TabControl.Value).Name = "Tab2" Then
 

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

Back
Top