Lock a tab on a tab control

M

microb0x

Is it possible to lock a single tab on a tab control? I know I can
set a tabs .visible property, but there doesnt seem to be a .locked
property like other objects.

I don't want to just disable all controls on the tab, I dont want the
end user to even be able to click that tab on the tab control, but
have it still be visible.

Any ideas?

I have a couple alternatives to mimic the functionality, but I'm
curious if this can be done with the standard tab control?
 
D

Dirk Goldgar

microb0x said:
Is it possible to lock a single tab on a tab control? I know I can
set a tabs .visible property, but there doesnt seem to be a .locked
property like other objects.

I don't want to just disable all controls on the tab, I dont want the
end user to even be able to click that tab on the tab control, but
have it still be visible.

Any ideas?

I have a couple alternatives to mimic the functionality, but I'm
curious if this can be done with the standard tab control?


You can use the tab control's Change event to control whether or not a
particular page can be displayed, by changing its value back to some other
page-index if the current page is to be "locked". For example:

'----- start of code -----
Private Sub tabMyTab_Change()

' Don't allow page 2 to be shown if that page is "locked".

If Me.tabMyTab = 1 Then

' Page 2 has become current. Will we allow that?

If Nz(Me.chkPage2Locked, False) Then

' No, we won't. Set the tab back to page 1.
Me.tabMyTab = 0

End If

End If

End Sub
'----- end of code -----
 
M

microb0x

You can use the tab control's Change event to control whether or not a
particular page can be displayed, by changing its value back to some other
page-index if the current page is to be "locked".  For example:

'----- start of code -----
Private Sub tabMyTab_Change()

    ' Don't allow page 2 to be shown if that page is "locked".

    If Me.tabMyTab = 1 Then

        ' Page 2 has become current.  Will we allow that?

        If Nz(Me.chkPage2Locked, False) Then

            ' No, we won't.  Set the tab back to page 1.
            Me.tabMyTab = 0

        End If

    End If

End Sub
'----- end of code -----

That should do the trick! I should have thought of that... Thanks for
the quick response!
 

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

Top