I have a user control which consists of a dataviewgrid with some extra panels controls etc.
I have just updated this program from an old version of vb where the tab control was just a row of tabs with no actual child pages attached.
so to use several of these userControls (called 'Pages' from now on) a Panel was created and placed underneath the tabs to give the illusion of tabpages.
when a user clicked a tab the relevant 'Page' was brought to the top of the Z order. This was accomplished with a directory of the 'Pages'
This all worked fine until I decided to change to using the TabControl in VS 2010.
So I didn't need the Panel anymore I just added the 'Pages' to the TabPages instead and I could also get rid of the directory to access the pages as
it is not needed for display purposes anymore and for other access I could use the Tabcontrol.TabPages collection instead.
Now when each 'page' is created and setup the dataviewgrid is loaded with a Table and the columns are re-ordered.
I am loading approx 20 'pages' to the tabcontrol 1 to each newly created tabpage obviously.
this is done using using a for each loop from a DB table.
now the problem is that the first 'page' dataviewgrid has the columns re-ordered but none of the others do ! the Data is fine it's just the column order that's wrong.
the same code is used for all (The setup is method of the 'Page') and i have stepped through the code and it all works OK with no exceptions.
no code is missed but the grid order is OK for the first 'page' but not the others.
everything else works fine the 'Pages' are all on the TabPages and the data is OK
Now comes the really weird bit! if I add the 'page' to the old unused panel before i add it to the Tabpage all the grids are re-ordered fine!
as in
MainPanel1.Controls.Add(MyAccountsUserPage) myTabPage.Controls.Add(MyAccountsUserPage)
Now the Panel is visible but not on screen if you see what i mean -
obviously if i move it on screen it's empty as the 'page' control can only be in one place and it's on the Tabcontrol !
so why is it working ONLY when I add it first to the unused Panel? what is happening here?
Oh BTW it only works for this Panel - not if i create a new one and add it to that!
AND if the Panel Visible property is set to false the columns are not re-ordered again??
I have tried deleting the panel and all code that uses it but the grids are not ordered properly till i re-instate the panel?
all the redundant code that used to use the panel is deleted except for the line above
I am only a hobby programmer and I think i must be missing something fundamental/obvious
I hope I have given enough information here - I don't think i need to give all the code as it would be fairly difficult and it all works perfectly except for this strange fault
can anyone help please as I am stumped.
thanks
Mike

New Topic/Question
Reply




MultiQuote





|