By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

Populating WinForms DataGrid

P: n/a
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.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Tom S. wrote:
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
Nov 21 '05 #2

P: n/a
This is also my question :
The topic of my thread is "Datagrid customization for custom objects".
Tom S. wrote:
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.

Nov 21 '05 #3

P: n/a
I've tried using the DataGridTableStyles, but from
everything I've read, you need to have a DataMember
assinged to the grid. But since this is a custom object
and not a collection of different tables from a database,
I can't use a data adapter with it, and therefore can't
assign a DataMember.
If I am incorrect in this, please let me know ( as I have
just been playing with this for a few days ). Otherwise,
are there any other suggestions??
Thanks!
-----Original Message-----
Tom S. wrote:
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 alwayslimit what columns to show/hide. There may be another way....
Chris
.

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.