472,123 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,123 software developers and data experts.

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:
Expand|Select|Wrap|Line Numbers
  1.  Dim number1 As Integer
  2.          Dim number2 As Integer
  3.          Dim multiplier As Integer
  4.          Dim answer As Integer
  5.          Dim i As Integer
  6.  
  7.         number1 = Val(TextBox1.Text)
  8.         number2 = Val(TextBox2.Text)
  9.  
  10.         multiplier = Val(TextBox3.Text)
  11.  
  12.        Do Until multiplier > multiplier + 1
  13.  
  14.            For i = number1 To number2
  15.  
  16.                 answer = i * multiplier
  17.                ListBox1.Items.Add(i & " Times " & multiplier & " = " & answer)
  18.            Next i
  19.  
  20.             multiplier = multiplier + 1
  21.  
  22.        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??
Jul 14 '09 #1
2 1362
I think i may have solved my problem..

The code on line 13 now reads:

Do Until Multiplyer > Val(Textbox3.Text)

It now gives me the desired result
Jul 15 '09 #2
smartchap
236 100+
Dear Steve
I think there is no need to use the Do Loop here.
Jul 16 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

23 posts views Thread by Jason | last post: by
1 post views Thread by Benton2862 | last post: by
28 posts views Thread by Nutkin | last post: by
1 post views Thread by al2004 | last post: by
9 posts views Thread by TF | last post: by
3 posts views Thread by gmdune | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.