You will want to use a datagridtable style.
DataGridTableStyle dts = new DatagirdTableStyle();
dts.MappingName = "The TYPE name of your class collection, e.g: 'ArrayList'
for an arraylist or if you are using a datatable the tablename of the
table";
DataGridTextBoxColumn textCol = new DataGridTextBoxColumn();
textCol.MappingName = "NameOfPublicProperty";
textCol.HeaderName = "Header";
dts.GridColumnStyles.Add(textCol);
this.dataGrid1.TableStyles.Add(dts);
Now the datagrid will show ONLY the columns specified in the tablestyle, all
other columns will be ignored, if you don't get the Mapping name right it
will display as normal.
"Bhargavan" <bh********@yahoo.co.in> wrote in message
news:Of**************@TK2MSFTNGP14.phx.gbl...
Hi,
I am using a datagrid on a windows form. The datasource of the grid is
bound to a class array. It works just fine. But I am not sure how to hide some
columns in the grid programmatically. Any suggestions in this regard will
be greatly appreciated.
Bhargavan M