如何在 vb.net 的一条语句中声明两个对象? 例子
If IsNumeric(TextBox1.Text),(TextBox2.Text) Then
lbl_answer.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Else
MsgBox("Error only number can be calculate")
End If
我可以
if isnumeric(textbox1.text) then
但我不能说
if isnumeric(textbox1.text), (textbox2.text)
我该怎么做?
最佳答案
到目前为止还没有人让我表达你的选择(直接来自评论 - 抱歉,但我不知道为什么这些不是答案):
和
If IsNumeric(TextBox1.Text) And IsNumeric(TextBox2.Text) Then ...
AndAlso
(细微差别:AndAlso
如果第一个表达式的计算结果为 false,则不计算第二个表达式)If IsNumeric(TextBox1.Text) AndAlso IsNumeric(TextBox2.Text) Then ...
我认为 LINQ 不是一个真正的选择。
关于windows - 如何在一个语句中评估两个函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10208838/