将c#代码转换为VB
我正在使用数学函数。代码如下。它是C代码。请使用CType(变量,类型)将其转换为VB。我试过了,但没有成功将c#代码转换为VB,c#,vb.net,C#,Vb.net,我正在使用数学函数。代码如下。它是C代码。请使用CType(变量,类型)将其转换为VB。我试过了,但没有成功 iTmpWidth = (Integer)(Math.Floor((double)((double)GridCol.Width / (double)iTotalWidth * (double)iTotalWidth * ((double)e.Mar
iTmpWidth = (Integer)(Math.Floor((double)((double)GridCol.Width /
(double)iTotalWidth * (double)iTotalWidth *
((double)e.MarginBounds.Width / (double)iTotalWidth))))
请帮忙。试试这个:
iTmpWidth = DirectCast(Math.Floor(CDbl(CDbl(GridCol.Width)
/ CDbl(iTotalWidth) * CDbl(iTotalWidth) * (CDbl(e.MarginBounds.Width)
/ CDbl(iTotalWidth)))), [Integer]);
很抱歉,堆栈溢出不是代码转换器。最好的对话方式是开始学习这两种语言,然后自己动手。请展示你的尝试。我只是试着打印gridview数据。上面的代码是以整数形式对齐marginError。错误更正为:将Integer更改为UInteger
CDbl
无法处理null
,因此可能引发异常无法强制转换
CDbl中没有错误,但在最后一个声明Integer中没有错误