Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用VB.Net防止DataGridView中的数字舍入_Vb.net_Winforms_Datagridview_Rounding - Fatal编程技术网

如何使用VB.Net防止DataGridView中的数字舍入

如何使用VB.Net防止DataGridView中的数字舍入,vb.net,winforms,datagridview,rounding,Vb.net,Winforms,Datagridview,Rounding,我在windows窗体vb.net应用程序中有一个datagridview。我的目标是将任何超过0.9999999999的12位有效数字向下舍入为0.9999999999 11位有效数字。我想阻止vb.net将这些值舍入到1。这就是我实现它的方式,但我不知道要使用哪个DataGridView事件处理程序 If DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value <= 0.999999999999 Then

我在windows窗体vb.net应用程序中有一个datagridview。我的目标是将任何超过0.9999999999的12位有效数字向下舍入为0.9999999999 11位有效数字。我想阻止vb.net将这些值舍入到1。这就是我实现它的方式,但我不知道要使用哪个DataGridView事件处理程序

If DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value <= 0.999999999999 Then
                DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = 0.99999999999
            End If

如果DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value您可以在加载之前对其进行更改

dataGridView1.Columns("ColumnName").DefaultCellStyle.Format = "F11"
或 您可以在