Rated
Read 38,098 times
Contents
Related Categories
For...Next statement - Skipping to the next loop
Skipping to the next loop
Unlike C++, VB does not provide is the option to go onto
the next item in the loop. You can get around this by using a label and a Goto statement:
For intCount = 1 To 10 Step 1
lngResult = Val(InputBox ("Enter a number"))
If > lngBig Then
'// New number is bigger
lngBig = lngResult
'// go onto next loop
GoTo NextLoop
End If
Msgbox "That number is less than " & lngBig
NextLoop:
Next intCount
James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.
Comments
Posted by davour on 01 Nov 2003
[quote]I need an equation such as a * b = c and a / c = b and b / c = a where the user types in 2 of the variables in text boxes and some proccess (such as a button click) would calculate the result....
I need to create an If...Then loop because I need an equation such as a * b = c and a / c = b and b / c = a where the user types in 2 of the variables in text boxes and some proccess (such as a butto...
What exactly do you mean by a circular reference...? (I know what you mean in reference to Excel, but I'm not sure how'd that translate to another language...) -
Is it possible to create a circular reference (in any programming language), because I know that Excel won't do it?
|