这个VB.NET代码“End Of Statement Unexpected”有什么问题?

时间:2015-10-12 15:24:24

标签: .net vb.net division

Dim x As Integer = dividedTwoTextBox.Text
If x%2 = 0 Then
    dividedByTwoFinalLabel.Text = "Yeah, It can be divided by two!"
End If

我不知道问题出在哪里,它在“2”号的x + 2部分给了我一个意外的结束声明。它能是什么?

1 个答案:

答案 0 :(得分:1)

您似乎想检查数字是否均匀,那么您需要这个

Dim x As Integer = CInt(dividedTwoTextBox.Text)
If x Mod 2 = 0 Then
    dividedByTwoFinalLabel.Text = "Yeah, It can be divided by two!"
End If