473,549 Members | 2,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1812
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 DataGridTableSt yles 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 DataGridTableSt yles, 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 DataGridTableSt yles 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
2261
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 DataGrid? I've found a number of postings and help topics but would like to find something that treats the DataGrid as a topic, not just a loose...
3
5278
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 grid-- all I want to do is write to the grid, read from it, and allow the user to enter text in particular cells. Is the WinForms datagrid a...
5
9171
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 a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row...
2
10560
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 several columns, the last of which (with the header Quantity) contains int16 values. When a user selects a row, I would like to have a combobox on...
4
3917
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 & "', '" & Context.User.Identity.Name & "'" UpdateCommand.ExecuteNonQuery()
5
2267
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 collection object -- say, a dictionary. Populating that collection object with custom objects, say, Person. What I really want to see is how to...
6
1797
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 VB 6.0 using the FlexGrid control but the I cannot figure out how to specify the row/column of the cell I want to set in the .Net DataGrid control...
1
1765
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" Runat=server DataValueField="UserName" DataTextField="UserName" DataSource='<%# GetUserList() %>'>
1
1469
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 open datagrid that has no connection to the databse as the bound datagrid have. We have began to use a third party datagrid that is called flygrid...
0
7542
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7467
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7736
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7827
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5110
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3514
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1079
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.