help with loop please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • steveuk87
    New Member
    • Jul 2009
    • 4

    help with loop please

    i need help!

    I'm currently trying to teach myself VB and its going good so far until the Do loops... i have an exercise that i can't seem to complete as i don't know the correct syntax to use can any one help?

    the code is as follows:
    Code:
     Dim number1 As Integer
             Dim number2 As Integer
             Dim multiplier As Integer
             Dim answer As Integer
             Dim i As Integer
      
            number1 = Val(TextBox1.Text)
            number2 = Val(TextBox2.Text)
     
            multiplier = Val(TextBox3.Text)
     
           Do Until multiplier > multiplier + 1
     
               For i = number1 To number2
     
                    answer = i * multiplier
                   ListBox1.Items.Add(i & " Times " & multiplier & " = " & answer)
               Next i
      
                multiplier = multiplier + 1
     
           Loop

    But i need to know what to put in the "Do Until multiplyer...." part to make it stop when the multiplyer is at the number the user types in!

    anyhelp??
    Last edited by Frinavale; Jul 21 '09, 08:15 PM. Reason: Please post code in [code] [/code] tags. Added code tags.
  • steveuk87
    New Member
    • Jul 2009
    • 4

    #2
    I think i may have solved my problem..

    The code on line 13 now reads:

    Do Until Multiplyer > Val(Textbox3.Te xt)

    It now gives me the desired result

    Comment

    • smartchap
      New Member
      • Dec 2007
      • 236

      #3
      Dear Steve
      I think there is no need to use the Do Loop here.

      Comment

      Working...