JakeDay, on 01 April 2011 - 12:50 PM, said:
I am trying to code a procedure that displays the squares of the even integers from 2 through 12 in a label control. I have to display each square on a separate line in the control using the For...Next statement.
Private Sub displayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles displayButton.Click
' calculates the squares of even integers from 2 through 12
Dim num As Integer = 2
Dim numSquared As Integer
Do While num <= 12
numSquared = num * num
num = num + 2
squaresLabel.Text = squaresLabel.Text & Convert.ToString(numSquared) & ControlChars.NewLine
Loop
End Sub
End Class
This is the code I figured out but it is using the Do...Loop Statement. This might be ok but if anyone knows how to put it in a For...Next statement please reply to this. Thank you
This post has been edited by JakeDay: 01 April 2011 - 01:09 PM

New Topic/Question
Reply



MultiQuote





|