INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Tab control and page control displaying different fields/controls based on tab page selected

Tab control and page control displaying different fields/controls based on tab page selected

Tab control and page control displaying different fields/controls based on tab page selected

(OP)
Dear All,
Thank you for a great forum!

I have the following problem.
I have several tab pages within a tab control.
Base on the tab page selected I want certain labels and text boxes to be visible/not visible and enabled/not enabled.

The main tab control is called:
tabCtlBcMain

The tab pages are called:
tabAbout
tabBuildingControlOperations
tabContraventions
tabDangerousStructures
The tab pages are my concern.
I tried the following and it does not seem to work:

CODE

Private Sub tabAbout_Click()
    
    tabAbout.SetFocus
    'enabled state T/F 
        txtStartDate.Enabled = False
        txtEndDate.Enabled = False
        cmdCalDate.Enabled = False
        cmdCalDateEnd.Enabled = False
        txtArea.Enabled = False
    'visibility 
        LbStartDate.Visible = False
        txtStartDate.Visible = False
        lbEndDate.Visible = False
        txtEndDate.Visible = False
        cmdCalDate.Visible = False
        cmdCalDateEnd.Visible = False
        txtArea.Visible = False
        lbArea.Visible = False
    tabAbout.SetFocus
End Sub  
I have tried variations of events - Change, Load...
This does not work.
Please help, I have tried for hours and search online up and down and nothing seems to be similar enough to guide me.
Thanks for your forthcoming help smile

Thank you,

Kind regards

Triacona

RE: Tab control and page control displaying different fields/controls based on tab page selected

No. Use the Change event of the tab control not individual pages. Value of the tab control is the page index. Pages are indexed 0 to N-1

CODE -->

Private Sub tabDemo_Change()
    Select Case tabDemo.Value
    Case 0
      'do some code for the first tab
    Case 1
       'do some code for second tab
    Case 2
       'do some code for third tab
    End Select
End Sub 

RE: Tab control and page control displaying different fields/controls based on tab page selected

(OP)
Thanks so so so much!!
Works perfectly!

Thank you,

Kind regards

Triacona

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close