Learn how to a build a cloud-first strategyRegister Now


Tab control in vb 2005

Posted on 2007-08-11
Medium Priority
Last Modified: 2013-11-26
I have a tab control on a form with 6 tabs. I would like to disable certain buttons on the form that are not on the tab if the focus changes to a different tabpage in the collection. I have tried the code below, but it doesn't work.

Private Sub TabPage2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
        If TabPage2.Focused Then
            btnFirst.Enabled = False
        End If

    End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
        If CBool(CInt(TabPage1.Focused)) Then
            btnFirst.Enabled = False
        End If

    End Sub
Question by:mindserve
1 Comment
LVL 48

Accepted Solution

Wayne Taylor (webtubbs) earned 200 total points
ID: 19675739
Hi mindserve,

Handle the parent TabControl's Click event....

    Private Sub TabControl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.Click
        If TabControl1.SelectedTab Is TabPage2 Then
            btnFirst.Enabled = False
        End If
    End Sub



Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question