我想格式化DataGridView中显示和捕获的小数位,我有一个最小小数位数和最大小数位数.例如:
If caught, "120.0" display "120.00"
If caught "120.01" display "120.01"
If caught "120,123" display "120,123"
If caught "120.1234" display "120.1234"
If caught "120.12348" display "120.1235" (round)
Run Code Online (Sandbox Code Playgroud)
在DataGridView列中,"txtcDecimal"具有属性(来自设计者)
txtcDecimal.DefaultCellStyle.Format = "N2";
txtcDecimal.DefaultCellStyle.Format = "0.00##"; // IS ANSWER. I do not work for an event that interfered
Run Code Online (Sandbox Code Playgroud)
掩码"0.00 ##"作为"n2"工作只得到2位小数,它正确舍入到两位小数但只是不喜欢我需要的东西(如我在示例中所示)
如何在不消耗大量资源的情况下以简单的方式完成这项工作?
谢谢harlam357和Tom Garske
占用一个将Visual Fox Pro emigrarlo迁移到C#的方法,我遇到的问题是如何知道Visual Fox Pro中的方法:
Rand(intValue)
Run Code Online (Sandbox Code Playgroud)
方法等于dotNet:
Random r = new Random (intValue);
r.Next return ();
Run Code Online (Sandbox Code Playgroud)
假设intValue = 971,dotNET中生成的结果是2027119,但我需要等于返回FoxPro.
主要问题:我如何确保获得相同的结果?
次要问题:你知道任何在线工具fox pro证明这个方法给我结果Rand()?