我有一行代码在一个语句中工作但不是第二个语句。我不确定我做错了什么,所以任何帮助都会受到赞赏。我正在缓慢但肯定地学习,并且由于我在这里找到的帮助,这是一个不小的差距=)错误发生在SECOND intResult = intSelection x intCount
Do
循环的While
行
蓝色波浪线在“intCount”下只是FYI
Dim intSelection As Integer
Dim intCount As Integer = 0
Dim intResult As Integer
Dim strDisplay As String
Private Sub txtSelection_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSelection.TextChanged
End Sub
Private Sub btnSelection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelection.Click
If intSelection >= 0 And intSelection <= 12 Then
Do While AdditionToolStripMenuItem.Checked = True And intCount <= 12
intResult = intSelection + intCount
strDisplay = intSelection & " + " & intCount & " = " & intResult
lstResults.Items.Add(strDisplay)
intCount += 1
Loop
Do While MultiplicationToolStripMenuItem.Checked = True And intCount <= 12
intResult = intSelection x intCount
strDisplay = intSelection & " x " & intCount & " = " & intResult
lstResults.Items.Add(strDisplay)
intCount += 1
Loop
Else
MsgBox("Please enter a value between 0 and 12", , "Input Error")
End If
End Sub
答案 0 :(得分:3)
intSelection x intCount
应该是intSelection *
intCount看看this MSDN page它解释了可用于VB.Net的运算符