Connecting Tech Pros Worldwide Help | Site Map

looping help

Newbie
 
Join Date: Jul 2009
Location: Merseyside, UK
Posts: 4
#1: Jul 14 '09
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.  
  2. Dim number1 As Integer
  3.         Dim number2 As Integer
  4.         Dim multiplier As Integer
  5.         Dim answer As Integer
  6.         Dim i As Integer
  7.  
  8.         number1 = Val(TextBox1.Text)
  9.         number2 = Val(TextBox2.Text)
  10.  
  11.         multiplier = Val(TextBox3.Text)
  12.  
  13.         Do Until multiplier > multiplier + 1
  14.  
  15.             For i = number1 To number2
  16.  
  17.                 answer = i * multiplier
  18.                 ListBox1.Items.Add(i & " Times " & multiplier & " = " & answer)
  19.             Next i
  20.  
  21.             multiplier = multiplier + 1
  22.  
  23.         Loop
  24.  
  25.  
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??
Newbie
 
Join Date: Jul 2009
Location: Merseyside, UK
Posts: 4
#2: Jul 15 '09

re: looping help


i think i have solved it anyway...

the code on line 13 now reads:

Do Until multiplier > Val(Textbox3.Text)

Which gives me the desired result
MrMancunian's Avatar
Expert
 
Join Date: Jul 2008
Location: Utrecht, The Netherlands
Posts: 274
#3: Jul 15 '09

re: looping help


Hi,

Good work on solving this yourself! If you want to teach yourself programming, I can recommend the MSDN pages. The samples are most of the time sufficient to learn new code etc.

Good luck!

Steven
Reply


Similar Visual Basic .NET bytes