For+Loops+(VB)

//DO SAME THING SEVERAL TIMES!!!//


 * For when (x) = 0 and until (x)=34, by stepping up by 1, the label will output the text to the user.**

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For x = 0 To 34 Step 1 lblOutput.Text = "This is me learning loops" & vbNewLine & lblOutput.Text Next 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 txtNumber.Enabled = False Dim intValue As New Integer intValue = txtNumber.Text For x = 1 To intValue Step 1 lblOutput.Text = x & vbNewLine & lblOutput.Text

Next End Sub

Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click Dim intValue As New Integer intValue = txtValue.Text For x = 1 To intValue lblOutput.Text = x + intValue Next End Sub End Class

Dim i As Integer

For i = 5 To 25 Step 5 Textbox1.Text=Textbox1.Text & vbNewLine & "Line" & i Next

Dim i As Integer Dim InpName As String For i = 1 To 10 InpName = InputBox("Enter name") If InpName = "Done" Then Exit For Textbox1.Text=InpName Next i