473,394 Members | 1,794 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,394 software developers and data experts.

How to add total in datagridview

Hi

I am using visual studio 2005 windows forms to create an application.
The heart of the application is datagridview which reads the data from
the database and display result to the user.

Now the data is numeric value and Some column needs to add total of the
column at the bottom of the datagrid.

I am binding datagrid to the dataset and then tryiing to add a row to
the datagrid but it is throwing exception saying

"row can not be programmatically added to the datagridview's row
collection when the control is databound"

Any Idea how can I display sum of the columns in the datagridview
control?

Any help would be highly appreciated.

Regards

Amit

May 2 '06 #1
2 12705
programmatically add the row to the dataset before you bind it.

--

Andrew Robinson

<am*******@gmail.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
Hi

I am using visual studio 2005 windows forms to create an application.
The heart of the application is datagridview which reads the data from
the database and display result to the user.

Now the data is numeric value and Some column needs to add total of the
column at the bottom of the datagrid.

I am binding datagrid to the dataset and then tryiing to add a row to
the datagrid but it is throwing exception saying

"row can not be programmatically added to the datagridview's row
collection when the control is databound"

Any Idea how can I display sum of the columns in the datagridview
control?

Any help would be highly appreciated.

Regards

Amit

May 2 '06 #2
I had a problem like this too, I managed to solve it using a label and
just put the
rows.count there...

May 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
2
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
0
by: =?Utf-8?B?SEdK?= | last post by:
I am looking for a beter way to show column total at the bottom of a DataGridView. The way I've done by setting labels at outside the bottom of the DataGridView and show the total values in the...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by...
2
by: TG | last post by:
Hi! I have a datagridview and I want to sum one of the columns. (column 5) When I run the following it gives me 0 instead of 10106 which is the total of those rows. Any ideas as to what I...
3
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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.