Changing tab page and tab control without firing selectedindex event

Posted on 2006-05-12
Last Modified: 2008-02-01
Well that is what I am attemping. I already have an event that fires when the user manually clicks each tab page, basically executing some SQL statements depending on what tab page they are on. So what I want to do is when someone is clicking on a datagrid row it shows the particular tabpage. Well I can do that with this line of code.


The problem is the darn tab page clicker up top still shows your on the datagrid page (tabpage3) , when you are on tabpage1, the tabcontrol just does not show correctly. What I cannot do is this

Me.TabControl1.SelectedIndex = 0

If I fire that event then it issues new select statements and that will mess me up. Is there anyway to focus on the tabindex without firing that off ?

Question by:reefcrazed
    LVL 85

    Accepted Solution

    Declare yourself a boolean flag that you set to True when you want to use this statement:

        Me.TabControl1.SelectedIndex = 0

    Then check the flag in your event.  If it is true, then simply reset it back to false, and exit the sub...otherwise continue with your SQL code.

    Author Comment

    You mean make it a public variable so all of the subroutines could us it. How about passing an optional boolean parameter into the subroutine, I am thinking that would work too. I am not at work right now to try it but going to on Monday.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now