0
我需要幫助轉換此代碼類型從Do Loop While
和Do While Loop
到For...Next
循環。我使用Visual Basic 2010 Express作爲運行這些代碼的程序,如果有人能幫助我,我將非常感謝。以下是需要轉換爲For ... Next循環類型的代碼。再次感謝任何能夠幫助的人。轉換時做循環到下一個循環
Private Sub btnDo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDo.Click
Dim intNum, intSum As IntegerDo
intSum += intNum ‘accumulator/running total
intNum += 2 ‘update intNum
Loop While (intNum <= 50)
Me.lblDoAnswer.Text = intSum.ToString
End Sub
Private Sub btnDoWhile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDoWhile.Click Dim intNum, intSum As Integer
Do While (intNum <= 50)
intSum += intNum ‘accumulator/running total
intNum += 2 ‘update intNum
Loop
Me.lblDoWhileAnswer.Text = intSum.ToString
End Sub