Home All Groups Group Topic Archive Search About

Populating WinForms DataGrid

Author
15 Apr 2005 3:40 PM
Tom S.
VS.Net 2003 V 7.1.3088
..Net Framework V 1.1.4322 SP1
WinXP SP2

I have a WinForms project that I'm having trouble with.  I
have a custom user control ( all code based, no visual )
and another class that is a collection of multiple
instances of the control.  In ASP.NET, if I wanted to bind
the data of the collection ( each control having it's own
row in the grid ) it was not a problem.  I was also able
to select only the column I wanted displayed by defining
the grid.  But I can't figure out how to do this in
WinForms.  I am able to populate the DataGrid without a
problem ( I've set the DataSource property to the
collection ), but I can't find out how to hide columns
that I don't want displayed.
Any help would be greatly appreciated!!  Thanks!!

Tom S.

Author
15 Apr 2005 4:50 PM
Chris
Tom S. wrote:
Show quoteHide quote
> VS.Net 2003 V 7.1.3088
> .Net Framework V 1.1.4322 SP1
> WinXP SP2
>
> I have a WinForms project that I'm having trouble with.  I
> have a custom user control ( all code based, no visual )
> and another class that is a collection of multiple
> instances of the control.  In ASP.NET, if I wanted to bind
> the data of the collection ( each control having it's own
> row in the grid ) it was not a problem.  I was also able
> to select only the column I wanted displayed by defining
> the grid.  But I can't figure out how to do this in
> WinForms.  I am able to populate the DataGrid without a
> problem ( I've set the DataSource property to the
> collection ), but I can't find out how to hide columns
> that I don't want displayed.
> Any help would be greatly appreciated!!  Thanks!!
>
> Tom S.

You need to look at the DataGridTableStyles class.  That is how I always
limit what columns to show/hide.  There may be another way....

Chris
Author
17 Apr 2005 9:34 AM
will
This is also my question :
The topic of my thread is "Datagrid customization for custom objects".


Tom S. wrote:
Show quoteHide quote
> VS.Net 2003 V 7.1.3088
> .Net Framework V 1.1.4322 SP1
> WinXP SP2
>
> I have a WinForms project that I'm having trouble with.  I
> have a custom user control ( all code based, no visual )
> and another class that is a collection of multiple
> instances of the control.  In ASP.NET, if I wanted to bind
> the data of the collection ( each control having it's own
> row in the grid ) it was not a problem.  I was also able
> to select only the column I wanted displayed by defining
> the grid.  But I can't figure out how to do this in
> WinForms.  I am able to populate the DataGrid without a
> problem ( I've set the DataSource property to the
> collection ), but I can't find out how to hide columns
> that I don't want displayed.
> Any help would be greatly appreciated!!  Thanks!!
>
> Tom S.