I need to prevent the user from changing tab in a tab control until it clicks on the "Finish" button on the current tab.

Thats all

Recommended Answers

There is a property called enabled, set it to false.

Jump to Post

All 4 Replies

There is a property called enabled, set it to false.

yes, but that disables all the controls on the tab control! i just need to disable to change tab...

Unfortunately Microsoft forgot to put in the e.Handled on a mouse event.

If you would like, you can create your own Class do deal with this. Then you just use e.Handled = True (on the TabControl MouseDown for example) and the mouse click will not get fired. I copied the code below for you:

Public Class MouseEventArgs
    Inherits System.Windows.Forms.MouseEventArgs

    Private _mHandled As Boolean

    ''' <param name="button">One of the System.Windows.Forms.MouseButtons 
    ''' values indicating which mouse button was pressed.</param>
    ''' <param name="clicks">The number of times a mouse button was pressed.</param>
    ''' <param name="x">The x-coordinate of a mouse click, in pixels.</param>
    ''' <param name="y">The y-coordinate of a mouse click, in pixels.</param>
    ''' <param name="delta">A signed count of the number 
    ''' of detents the wheel has rotated.</param>
    <DebuggerHidden()> _
    Sub New(ByVal button As MouseButtons, _
    ByVal clicks As Integer, _
    ByVal x As Integer, _
    ByVal y As Integer, _
    ByVal delta As Integer)
        MyBase.New(button, clicks, x, y, delta)
        Me._mHandled = False
    End Sub

    ''' <summary>
    ''' Gets or sets a value indicating whether the event was handled.
    ''' </summary>
    Public Property Handled() As Boolean
        <DebuggerHidden()> _
            Return Me._mHandled
        End Get
        <DebuggerHidden()> _
        Set(ByVal value As Boolean)
            Me._mHandled = value
        End Set
    End Property

End Class

ok thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.