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
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.
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

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
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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of MichMat
MichMat

ASKER

Works perfectly thank you
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Glad I could hep!
jpaulino
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo