AWestEng
asked on
Get all data from a column in a datagridview
Hi..
How do I get all data from a column in a datagridview
I want to calulate the total amount in one column
How do I get all data from a column in a datagridview
I want to calulate the total amount in one column
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that AWestEng just wants the total in a variable!
Hi,
you can use the DataColumn.Expression Property which also provide aggregation and sum's collumns
http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
if you're working with DataTables, you can perform aggregate function over its rows. For example, table.Compute("sum(price)" , "") would calculate the sum on all rows over price column in your DataTable.
as shown here
dim myvalue as Object
myvalue = dsSale.Tables("Grid").Comp ute("Sum(c olumnToBeC alulated)" , "")
should give the total(sum of all rows) in that column.
vbturbo
you can use the DataColumn.Expression Property which also provide aggregation and sum's collumns
http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
if you're working with DataTables, you can perform aggregate function over its rows. For example, table.Compute("sum(price)"
as shown here
dim myvalue as Object
myvalue = dsSale.Tables("Grid").Comp
should give the total(sum of all rows) in that column.
vbturbo
ASKER
thx guys.. :)
ASKER
ops I was to fast vbturbo:, did not see you message sorry.
No problem
Just glad you solved it -:)
Just glad you solved it -:)