|
-
Sep 28th, 2006, 06:01 PM
#1
Thread Starter
Member
[2005] Datagridview column visibility
Hello,
I have a problem with a datagridview. In the datagrid view I have the primary key and foriegn key values that are inserted into it when the rowsadded event is fired. This works great except for the fact that I do not want my users to see the pk/fk values, and would like to not show them at all. If I set the visibility property to false, the values are not set, and throws an exception when they try and save.
I tried looking into the mappingtype property but have been unable to solve the problem.
How can I hide the columns but still have their values correctly stored?
Thanks,
Chris
-
Sep 28th, 2006, 06:30 PM
#2
Re: [2005] Datagridview column visibility
YourDataGridView.Columns(your_col_index).Visible = True / False as needed.
-tg
-
Oct 7th, 2006, 03:16 PM
#3
Member
Re: [2005] Datagridview column visibility
I also have found that this works:
VB Code:
'Hide the column and attach dataset's DefaultView to the datagrid control
DSBinData.Tables(0).Columns(7).ColumnMapping = MappingType.Hidden
Where '0' is the index of which table you are using and '7' is which column number you are hiding. Hope this helps!
-
Oct 7th, 2006, 06:16 PM
#4
Re: [2005] Datagridview column visibility
You shouldn't use the ColumnMapping property of a DataColumn to hide a DataGridView column because that is not it's purpose. It has that effect but that is not its primary purpose so it has other implications as well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|