|
Question : Ways to hide columns in datatable and datagrid - win forms
|
|
What are all of the ways to hide a column in a datatable and a datagrid in windows forms?
|
|
Answer : Ways to hide columns in datatable and datagrid - win forms
|
|
As you can't actually SEE columns in a datatable, I agree that - strictly - you can't HIDE them in a DataTable. But
dt.Columns(3).ColumnMapping = MappingType.Hidden
means that they won't show up in the DataGridView, either. That's not the real purpose of my post though. I'm certainly not recommending it, as that setting can have consequences elsewhere.
My real point is that a DataGrid is a different animal from a DataGridView and its methods are different - and far more complicated. In that setting, I might well recommend the ColumnMapping route. Otherwise you need to get a TableStyle for the DataGrid, and a ColumnStyle from that, and set the .Width to 0 in that. This site's very useful on questions like that
http://www.syncfusion.com/FAQ/WindowsForms/
Roger
|
|
|
|