Sum Totals From DataGridView

B

BD

Hello all, writing application with VS 2005 using C# to link up with
SQL Server 2005. I have a form Purchase Orders with a DataGridView
control for my line items. I have added a column "Amount" on
DataGridView control to compute unit price times quantity. However,
at the foot of the form, I want to add a Textbox or other control to
show the Sum of the Amounts in the line items. I have been working
with this for days and any help would be greatly appreciated.
 
N

Nicholas Paldino [.NET/C# MVP]

Are you binding to a DataTable or something else? Regardless, why not
cycle through the items in your data to compute this number?

Either that, or return it as part of the query that selects the data in
the first place.
 
B

BD

Are you binding to a DataTable or something else? Regardless, why not
cycle through the items in your data to compute this number?

Either that, or return it as part of the query that selects the data in
the first place.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Hello all, writing application with VS 2005 using C# to link up with
SQL Server 2005. I have a form Purchase Orders with a DataGridView
control for my line items. I have added a column "Amount" on
DataGridView control to compute unit price times quantity. However,
at the foot of the form, I want to add a Textbox or other control to
show the Sum of the Amounts in the line items. I have been working
with this for days and any help would be greatly appreciated.- Hide quoted text -

- Show quoted text -

I have been able to compute the total of the amounts but that is not
what I am after. Quickbooks gives a good example of what I am trying
to do. The Quickbooks invoice form has a footer at the botton for
SubTotal, Tax, and Total. They only compute the line items for that
invoice that is visible. I have not been able to produce a similiar
result.
 
B

BD

I have been able to compute the total of the amounts but that is not
what I am after. Quickbooks gives a good example of what I am trying
to do. The Quickbooks invoice form has a footer at the botton for
SubTotal, Tax, and Total. They only compute the line items for that
invoice that is visible. I have not been able to produce a similiar
result.- Hide quoted text -

- Show quoted text -

I accomplished this feature in VBA Access with this as the control
source for a textbox:
=nz(WorkOrderMaterial.Form![Total Parts])
Maybe that will help with what I am trying to do.

Thanks, BD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top