I have a line of code that is working in one statement but not the second statement. I’m not sure what I’m doing wrong, so any help would be appreciated. I am learning slowly but surely, and it is by no small margin because of the help I have found here =) The error is occuring in the intResult = intSelection x intCount line of the SECOND Do While Loop.
The blue squiggle line is under “intCount” just 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
intSelection x intCountshould be intSelection*intCount Take a look at this MSDN page it explains the operators that are available for VB.Net