473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Populating WinForms DataGrid

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
3 1806
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Spiegel | last post by:
Hey all, I have contusions and I think a minor concussion after trying to find information on advanced WinForms DataGrid use. Does anyone know of a site / book that gets really in-depth on the...
3
by: Dave Veeneman | last post by:
I am just getting into the WinForms data grid, and just about everything I am seeing on it seems to say that the grid must be bound to an ADO.Net dataset. I want to use the grid as a simple unbound...
5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
2
by: Robert | last post by:
I'm sure this is a fairly basic question, but I've been looking all over the web for days for suggestions on how to do this. I've got a datagrid that's bound to a dataset on my form. It includes...
4
by: Paul | last post by:
I sometimes get a timeout error when populating my datagrid, the code is WizardConnection.Open() UpdateCommand.CommandText = "EXECUTE sp_assign_user '" & PhysOffice.SelectedValue & "', '" &...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
6
by: fripper | last post by:
I want to populate the cells of a DataGrid at run time. I don't want to bind a database to it I simply want to do some calculations and put results into the grid programmatically. I did this in...
1
by: Mike P | last post by:
I am populating a drop down column in a datagrid on page load. Here is my code : <asp:TemplateColumn> <ItemTemplate> <asp:DropDownList ID="ddlUserName" Font-Name="Verdana" Font-Size="8pt"...
1
by: TonyJ | last post by:
Hello! If there is a datagrid in VS2005 for winforms what kind of datagrid is it then. 1.Is it a bound datagrid that has a direct connection to columns for tables in the database. 2. Is it an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.