Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Reorders my Tab Pages at unknown times !

Status
Not open for further replies.

Goodall

MIS
Aug 4, 2004
18
US
Here is a frustrating problem I've been experiencing while developing a windows application in VB .NET 2003 Standard. I have a Tab Control which I've added tab pages to with unique content to each page. the Tab Control has 12 tab pages in the TabPages collection. I use the TabPage Collection Editor to add/delete/update the pages and the pages are setup in a particular order that I want. In addition VB automatically adds code to the form's InitializeComponent event to layout the pages in the proper order. Below is the code which adds the pages and in which order they are to be added. The number on each of those pages is the order they should be in.

Me.tcSelections.Controls.Add(Me.tp0CustType)
Me.tcSelections.Controls.Add(Me.tp1HOModel)
Me.tcSelections.Controls.Add(Me.tp2RespModel)
Me.tcSelections.Controls.Add(Me.tp3ListMP)
Me.tcSelections.Controls.Add(Me.tp4ClusterStatus)
Me.tcSelections.Controls.Add(Me.tp5CPModel)
Me.tcSelections.Controls.Add(Me.tp6FICO)
Me.tcSelections.Controls.Add(Me.tp7CFCredit)
Me.tcSelections.Controls.Add(Me.tp8RiskRank)
Me.tcSelections.Controls.Add(Me.tp9Lang)
Me.tcSelections.Controls.Add(Me.tb10States)
Me.tcSelections.Controls.Add(Me.tb11Branches)

Here is the problem. At indiscriminate times while I am adding code, editing the form controls, executing the program, hell whenever it seems, VB will change the order of the tab pages. Below is an example of the new order.

Me.tcSelections.Controls.Add(Me.tp0CustType)
Me.tcSelections.Controls.Add(Me.tp1HOModel)
Me.tcSelections.Controls.Add(Me.tp5CPModel)
Me.tcSelections.Controls.Add(Me.tp3ListMP)
Me.tcSelections.Controls.Add(Me.tp4ClusterStatus)
Me.tcSelections.Controls.Add(Me.tp9Lang)
Me.tcSelections.Controls.Add(Me.tp6FICO)
Me.tcSelections.Controls.Add(Me.tp7CFCredit)
Me.tcSelections.Controls.Add(Me.tp8RiskRank)
Me.tcSelections.Controls.Add(Me.tp2RespModel)
Me.tcSelections.Controls.Add(Me.tb10States)
Me.tcSelections.Controls.Add(Me.tb11Branches)

To correct this I have to go into the InitializeComponent section and reorder the pages. Sometimes I can go into the TabPage Collection editor and put the pages back in proper order and click OK to correct the order. Even that approach sometimes does not work.

Why is VB exhibiting this desctructive behavior? How do I correct the situation?
 
Yes, this is a problem that MS has not fixed yet. You will have to watch your tabs carefully and reorder them in the code editor occasionally. What I have found (at least on my machine) is this tab reordering almost never occurs IF you select your tab pages using the properties window pulldown and NOT on the form itself. What I do is select the tab from properties pulldown - then tab displays on form - at that time I click on the tab on the form to add controls etc.

Try not selecting your tabs from the Form and DO NOT click the little scroll arrows on the tab control on the form because many times this alone will REORDER the tab pages on their own.

No gurantees - so good luck,
Terry

"Do or Do Not, There is no Try"
Yoda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top