Do+Loops+(VB)

DON'T KNOW HOW MANY TIMES TO EXECUTE!!

Do While //condition// //block of statements to be executed// Loop


 * This is a loop that will increase a counter by 1 each time through the loop. The counter begins at 0. The text is outputted on the label, each time the loop executes, while the counter is less than 34.**

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As New Integer X = 0 Do While X <= 34 lblOutput.Text = "This is me learning loops" & " " & vbNewLine & lblOutput.Text X = X + 1 Loop

End Sub End Class


 * This is a loop that will run from 1 to the value that the user inputted into the textbox (intValue). The counter (x) increases by 1 each time through the loop....using the Step 1 command. Step simply means that the counter increases by the specified amount. Each time through the loop, the label outputs the value of the counter (x) on a new line, adding to the (x) value from before. The loop continues while the value that the user entered (intValue) is greater than (x).**

Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click Dim x As Integer txtNumber.Enabled = False Dim intValue As New Integer intValue = txtNumber.Text Do x = 1 To intValue Step 1 lblOutput.Text = x & vbNewLine & lblOutput.Text Loop While x < intValue End Sub End Class