尝试将其转换为十进制会出错 它是gridview的行单元格
e.Row.Cells(i).Text = If(CType(e.Row.Cells(total).Text, Decimal) = 0, "-", (CType(e.Row.Cells(total).Text, Decimal) * 100 / CType(e.Row.Cells(total).Text, Decimal)).ToString("0.00") + "%")
答案 0 :(得分:1)
Dim temp As Decimal
temp=0
IF Decimal.TryParse(e.Row.Cells(total).Text, temp) THEN
e.Row.Cells(i).Text = If(temp = 0, "-", (temp * 100 / temp).ToString("0.00") + "%")
ELSE e.Row.Cells(i).Text = "-"