tabpage order

  • Thread starter Thread starter mgarner1980
  • Start date Start date
M

mgarner1980

My tabpage order keeps getting scrambled. I saw somewhere that the IDE was
suspected for doing this. I've added the following code after the initailize
componant toi no avail. Any ideas?

'This call is required by the Windows Form Designer.

InitializeComponent()

TabControl1.Controls.SetChildIndex(Activities, 0)

TabControl1.Controls.SetChildIndex(Material, 1)

TabControl1.Controls.SetChildIndex(Kits, 2)

TabControl1.Controls.SetChildIndex(Sync, 3)

TabControl1.Controls.SetChildIndex(Settings, 4)
 
Ok, I'm obviously doing something wrong! Below is the code I modified. Am I
putting it in the correct place? The order when run is
Activities,Kits,Material,Sync,Settings

Thanks

Public Class frmMain

Inherits System.Windows.Forms.Form

Friend WithEvents Activities As System.Windows.Forms.TabPage

Friend WithEvents Material As System.Windows.Forms.TabPage

Friend WithEvents Kits As System.Windows.Forms.TabPage

Friend WithEvents Sync As System.Windows.Forms.TabPage

Friend WithEvents Settings As System.Windows.Forms.TabPage

Public Shared mymidaps_db As midaps_db

Public Shared mylocalce_db As localce_db

' Public Shared mybadgeinput As badgeinput

Public Shared myawsmapi As awsmapi

Private strsqlserver As String

Private lastform As String

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

TabControl1.Controls.SetChildIndex(Settings, 1)

TabControl1.Controls.SetChildIndex(Sync, 1)

TabControl1.Controls.SetChildIndex(Kits, 1)

TabControl1.Controls.SetChildIndex(Material, 1)

TabControl1.Controls.SetChildIndex(Activities, 1)

'Add any initialization after the InitializeComponent() call

End Sub
 
Based on your code that's what I'd expect. Look at what it's doing, it
insert each page as the first in the order, so they'll end up in the reverse
order of your addition. The reason I did it this way is it works for any
number of pages.
 
If you look closer, you'll see that kits and materials are out of order.
I expected :
Activities,Material,Kits,Sync,Settings

But when it runs its:
Activities,Kits,Material,Sync,Settings
 
Don't know if this will help, but I ended up naming my tab pages using the
following naming convention (using your example below);

0Activities,1Material,2Kits,3Sync,4Settings

and this seems to keep the order. Again, it just seemed to work for me,
don't know if this will help or not.

Bill

--------------
 
Back
Top