By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,835 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

Rounding Datasets/Datagrids

P: n/a

Hey

I am doing a basic report using a dataset and datagrid, and would like
to round some of the decimal values (to 1 and 2 places) as some of the
values go down to 8 decimal places, anyone know an easy way to do this?
Thanks in advance,

Les :)
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Les,

Use:

Decimal.Round(cdec(objDR("decimalfield")), 2)

That will give you a value rounded to 2 decimal places. objDR represents a
DataRow object. You can convert the line above to a string using CStr() and
assign the value as a string wherever it needs to go. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight

"Les Hughes" <le**********@datarev.com.au> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...

Hey

I am doing a basic report using a dataset and datagrid, and would like
to round some of the decimal values (to 1 and 2 places) as some of the
values go down to 8 decimal places, anyone know an easy way to do this?
Thanks in advance,

Les :)

Nov 21 '05 #2

P: n/a
Math.Round(3.44, 1) 'Returns 3.4.
"Les Hughes" wrote:

Hey

I am doing a basic report using a dataset and datagrid, and would like
to round some of the decimal values (to 1 and 2 places) as some of the
values go down to 8 decimal places, anyone know an easy way to do this?
Thanks in advance,

Les :)

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.