Link to home
Start Free TrialLog in
Avatar of MichMat
MichMat

asked on

Tab Control VB.net

Hi ,

I would like to stop the user from clicking any control in a spacific TAB if a certain condition exists is this posible , the alternative is to add that condition check to every control on the tab just the one would be so much easier

Michal
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Hi MichMat,

Once you selected that specific tab, you can determinate if the controls are accessible or not, and use a loop on then to enable/disable. It easy that way :)
Avatar of MichMat
MichMat

ASKER

Im not following you , how would I determine that the controls are accesible ?

the tab control has 5 tabs I would like to do this only with the controls of tab 4.
When you select the tabpage4 you can decide (based on some criteria) if the controls are enabled or not. You can place all them inside a container (like a panel) and that way you just have to enable/disable the container and not all.

    Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
 
        ' 3 = tab 4
        If Me.TabControl1.SelectedIndex = 3 Then
 
            ' Decision if enables or disables the controls
            Stop
 
        End If
 
    End Sub

Open in new window

Avatar of MichMat

ASKER

I actually have them in a group box would that be suitable ? and how would I disable that ?
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MichMat

ASKER

Works perfectly thank you
Glad I could hep!
jpaulino