Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Does Tabcontrol Remove Tab Effect Selected Index?

Posted on 2011-03-22
3
Medium Priority
?
403 Views
Last Modified: 2012-05-11
I would like to 'hide' a TabControl 'tab', but unsure how if effects the 'SelectedIndexChanged' event and a 'Switch' statement. I may confusing hide or visible with and actual Tab Remove.

tabControl1.TabPages.Remove(tabPage2);

Q. Will 'Remove' tab also remove its selectedIndex thus changing the switch & case below?

 switch (this.tabControl1.SelectedIndex)
 {
      case 0:
          do something...
      break;
     
      case 1:
          do another thing...
      break;
     
      case 2:
          do method...
      break;

      case 3:
          do another method...      
      break;
0
Comment
Question by:pointeman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Naman Goel earned 1000 total points
ID: 35190233
yes it will basically we have a collection in TabControl for TabPages and Remove will remove the give Tab from that collection so that will definately affect TabIndex of each tab and in turn will affect SelectedIndex property

so instead of using SelectedIndex use SelectedTab property

0
 

Author Comment

by:pointeman
ID: 35192608
Very nice, been using index long time. SelectedTab is better.

switch (tabControl1.SelectedTab.Name)
               
- or -

switch (e.TabPage.Name)
0
 
LVL 13

Expert Comment

by:Naman Goel
ID: 35195646
yes... agreed. or you can assign Tag property with the required unique value for each TabPage and use it

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 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