错误:从字符串“"的转换输入“整数"无效

编程入门 行业动态 更新时间:2024-10-25 22:33:48
本文介绍了错误:从字符串“"的转换输入“整数"无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 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

更多推荐

错误:从字符串“"的转换输入“整数"无效

本文发布于:2023-05-26 19:30:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/265226.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:整数   字符串   错误   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!