Changing tab page and tab control without firing selectedindex event

Posted on 2006-05-12
Medium Priority
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 86

Accepted Solution

Mike Tomlinson earned 750 total points
ID: 16670729
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

ID: 16677527
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.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 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