本文介绍了错误:从字符串“"的转换输入“整数"无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Select Case dlg
Case Windows.Forms.DialogResult.Yes
If TextBox12.Text = "" Then
Dim a, b, c As Integer
a = TextBox7.Text
b = TextBox8.Text //my problem
c = TextBox11.Text
TextBox12.Text = a + b - c
End If
If TextBox6.Text = "" Then
TextBox6.Text = "-"
End If
我不知道如何解决这个错误:
I don't know how to fix this error:
从字符串 "" 到类型 'Integer' 的转换无效
Conversion from string "" to type 'Integer' is not valid
推荐答案尝试使用 Integer.Parse:
Try using Integer.Parse:
Select Case dlg Case Windows.Forms.DialogResult.Yes If TextBox12.Text = "" Then Dim a, b, c As Integer a = Integer.Parse(TextBox7.Text) b = Integer.Parse(TextBox8.Text) //my problem c = Integer.Parse(TextBox11.Text) TextBox12.Text = a + b - c End If If TextBox6.Text = "" Then TextBox6.Text = "-" End If更多推荐
错误:从字符串“"的转换输入“整数"无效
发布评论