GridView problem on Page 2+ of a TabControl

  • Thread starter Thread starter Richard Carpenter
  • Start date Start date
R

Richard Carpenter

I have a four-page tabcontrol with a gridview on each page. I have the
primary key column of each gridview set to hidden (visible = false),
but it still shows up on all but the first page. Anyone else see this
behavior? How might I correct it?
 
Minor correction - I am dealing with datagridviews. Also, I thought I
would detail my subsequent recreating of the problem using a more
simplified environment and fewer variables:

I just reproduced this scenario on another PC with VS 2005 SP1
installed and got the same behavior. To do so, I created a new database
with three simple tables - a parent table and two child tables in the
SQL 2005 Express database. I created primary key columns in each table
and foreign key columns in the two child tables. I defined
relationships in the database for both child tables with the parent
table (child.foreignkey to parent.primarykey).

I created a new dataset in a new VB windows project which automatically
imported those relationships as well. I dragged the parent table from
the project data sources window onto a form as a datagridview as well
as the two related child tables listed below the parent table node.
Running the form showed correct relational behavior, and the primary
key columns I set to visible = false on both child datagridviews were,
indeed, hidden.

I then added a tabcontrol to the form and dragged each child
datagridview to a seperate tab of the tabcontrol. Upon running the
form, the datagridview on the first tab still displays correctly, while
whichever datagridview is on the second tab fails to hide the primary
key column as specified. When I change the tabs collection properties
of the tabcontrol to move Tab2 to the top, and therefore be displayed
first, then the datagridview on Tab2 displays correctly, while that on
Tab 1 (now displayed as the second tab) fails to hide the "hidden"
column.

I can't imagine why this behavior would be by design, so I am assuming
it is a bug. Unfortunately, I also can't imagine that, if it *is* a
bug, they wouldn't consider it important enough to include a fix in
SP1.

Anyone else wrestling with this? How are you getting around it?
 
Back
Top