Results 1 to 3 of 3

Thread: [RESOLVED] Disable switching tabs.

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    34

    Resolved [RESOLVED] Disable switching tabs.

    I have an SSTab control on my form with several tabs. I would like to disable the switching of tabs while a certain condition is true.

    I have tried several things, none of which work correctly.

    This worked fine on my laptop:

    Code:
    Private Sub tabMainForm_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If editMode > 0 Then
             MsgBox "Please finish entering information. Click Save or Cancel."
        End If
    'End Sub
    But not on my PC, which I thought was strange.

    Any ideas?

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Disable switching tabs.

    Try something like this instead:
    Code:
    Option Explicit
    
    Dim editMode As Boolean
    
    Private Sub Form_Load()
        SSTab1.Tab = 1
    End Sub
    
    Private Sub Command1_Click()
        editMode = Not editMode
    End Sub
    
    Private Sub SSTab1_Click(PreviousTab As Integer)
    Static currentTab As Integer
    
        If editMode Then
            SSTab1.Tab = currentTab
        Else
            currentTab = SSTab1.Tab
        End If
    
    End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    34

    Re: Disable switching tabs.

    Hi, sorry for the delay. That worked a treat, thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width