calculating columns can kill (me)

vortex

Member
Joined
Jul 1, 2005
Messages
8
Programming Experience
Beginner
Hi,

I am trying to set up a calculated column on a datagrid which is bound to a dataset.


I have been using an expression column that calculates the total eg:


VB.NET:
Expand Collapse Copy
[COLOR=black][FONT=Verdana]ds.Tables("Price_Detail").Columns.Add("NewPrice", System.Type.GetType("System.Decimal"))[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]ds.Tables("Price_Detail").Columns("NewPrice").Expression = "base_price/100 * (100 + percentage))"[/FONT][/COLOR]


but this has been giving me rounding problems (needs to be 2 decimal places).



Is there a way of rounding computed columns or do i have to calculate the total manually and if so how can i do that (using CurrentCellChanged ?).


many thanks for any help
 
does this help?

VB.NET:
Expand Collapse Copy
ds.Tables("Price_Detail").Columns("NewPrice").Expression = "ROUND(base_price/100 * (100 + percentage)), 2)"

-tg
 
Back
Top