(vb.net)舍入到小数点后两位 [英] (vb.net) rounding to 2 decimal places

查看:451
本文介绍了(vb.net)舍入到小数点后两位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个项目创建程序,这将有助于我学习视觉基础。但是当我计算出某种材料的尺寸值时。它带有两个以上的小数位。我知道如何使用math.floor函数,但不能四舍五入到小数点后两位。

I am creating a program for a project that will help me learn visual basic. But when I work out how much a certain material is worth with dimensions. It come out with more than two decimal places. I know how to use math.floor function but it doesn't round to 2 decimal places.

有人知道我应该使用什么函数将小数点后两位舍入吗?

Does anyone know what function I should use to round to two decimal places?

推荐答案

Decimal.Round 方法将为您解决问题。
您可以指定小数位数。

The Decimal.Round method will do the trick for you. You can specify the number of decimal places.

这篇关于(vb.net)舍入到小数点后两位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆