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
Visual Basic.NET

Avatar of undefined
Last Comment
Jorge Paulino

8/22/2022 - Mon
Jorge Paulino

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 :)
ASKER
MichMat

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.
Jorge Paulino

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

Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER
MichMat

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

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
MichMat

Works perfectly thank you
Jorge Paulino

Glad I could hep!
jpaulino
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.