简体   繁体   English

如何使用vb.net获得6位小数精度

[英]How to get 6 decimal precision using vb.net

How to get 6 decimal precision using vb.net as in this example (7090982.885183 (6 decimal places precision)) ie i want to read the .885183 in my previous sample as 6 decimal only. 如何在本例中使用vb.net来获取6位小数精度(7090982.885183(6位小数精度)),即我想将上一个示例中的.885183读为6位小数。

The javascript for the above looks like : 上面的javascript看起来像:

    //declare variables and assign calculated values
var HashA = OrdNo * Amt;
var HashB = MerchID * Amt;
var HashC = MerchID * OrdNo;
var TotalHash = String((HashA + HashB + HashC) / (parseInt(MerchID) + parseInt(RCode)));

//assign only 6 decimal places value
if (TotalHash.indexOf(".") != -1)
    TotalHash = TotalHash.substr(0,TotalHash.indexOf(".")+7);
else
    TotalHash = TotalHash + ".000000";

document.form1.HashCount.value = TotalHash;

} }

I need to read this no 7090982.8851830000011 as this format 7090982.885183 我需要阅读此编号7090982.8851830000011,因为此格式为7090982.885183

What about using % operater like 怎么样使用%operator这样

you have an variable a and variable decimalresult you should code it like this 你有一个变量a和一个十进制变量结果,你应该这样编码

decimalresult=a % 1000000

In this example it should be 在这个例子中应该是

decimalresult= 7090982.885183 % 1000000
decimalresult = 885183

如果您使用的是Decimal并且想要获取小数点后的值,则可以

result = input - Math.Floor(input)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用vb.net从数据库获取二进制图像 - How to get binary to image from database using vb.net 在 VB.NET 中,如何让文本框只允许一个小数点,&lt; 3NUMBERS 之前,只有 1NUMBER 之后? - In VB.NET how do I get a textbox to only allow one decimal point, < 3NUMBERS before it, and only 1NUMBER after it? 如何在ASP.Net上使用VB.Net从DataTable获取1列数据并将其显示给Lable - How to get 1 column data from DataTable and display it to Lable using VB.Net on ASP.Net 如何使用asp.net + vb.net从数据库列中获取数据并显示在下拉列表中 - How to get data from database column and display in dropdownlist using asp.net + vb.net 如何使用vb.net在asp.net中的下拉列表中获取当前值 - How to get the current value if dropdownlist in asp.net using vb.net 在 vb.net 中使用 OAuth 1.0 获取 JSON - Get JSON using OAuth 1.0 in vb.net 使用VB.net从HTML列表中获取项目 - Get items from HTML list using VB.net 使用VB.Net获取Gridview中订单ID的行号 - Get Row Number of an Order ID in Gridview using VB.Net 如何使用vb.net使SOAP响应并使选定的元素进入文本框/数据集 - how to make SOAP RESPONSE and get selected element into textbox/dataset using vb.net 如何使用Vb.Net中的连接字符串将数据库中的数据获取为mu UI形式 - How to get the Data in the database to mu UI form using Connection string in Vb.Net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM