以下代码提供从字符串到doble的错误转换无效
Dim TaxRebate = CDbl(ComboBox1.SelectedItem) * 0.01 * CDbl(Premium)
对此有所帮助表示赞赏 Sunilsb
答案 0 :(得分:0)
答案 1 :(得分:0)
'Dim TaxRebate = CDbl(ComboBox1.SelectedItem) * 0.01 * CDbl(Premium)
Dim value1 As String
Dim number1 As Double
Dim value2 As String
Dim number2 As Double
Dim TaxRebate As Double
value1 = ComboBox1.SelectedItem.ToString()
value2 = Premium.ToString()
If False = Double.TryParse(value1, number1) then
Console.WriteLine("{0} is outside the range of a Double.", value1)
ElseIf False = Double.TryParse(value2, number2) Then
Console.WriteLine("{0} is outside the range of a Double.", value2)
Else
TaxRebate = 0.01 * number1 * number2
End If
答案 2 :(得分:0)
简单
Dim TaxRebate As Double = CDbl(ComboBox1.SelectedItem) * 0.01 * CDbl(Premium)
将解决问题。
我们必须声明它们的变量/文本字符串
Dim ------正如Doule =