Repeating a statement until a condition becomes true, Visual Basic Programming

You can employ until keyword in two ways to verify a condition in a Do...Loop statement. You can verify the condition before you enter the loop (as illustrated in the following ChkFirstUntil instance), or you can verified it after the loop has run at least once (as illustrated in the ChkLastUntil instance). As long as the condition is False, the loop will be continues.

Sub ChkFirstUntil()

Dim counter, myNum counter = 0

myNum = 20

Do Until myNum = 10 myNum = myNum - 1 counter = counter + 1

Loop

MsgBox "The loop made" & counter & "repetitions." End Sub

Sub ChkLastUntil()

Dim counter, myNum counter = 0

myNum = 1

Do

myNum = myNum + 1 counter = counter + 1

Loop Until myNum = 10

MsgBox "The loop made " & counter & " repetitions." End Sub

Posted Date: 4/18/2013 5:50:48 AM | Location : United States







Related Discussions:- Repeating a statement until a condition becomes true, Assignment Help, Ask Question on Repeating a statement until a condition becomes true, Get Answer, Expert's Help, Repeating a statement until a condition becomes true Discussions

Write discussion on Repeating a statement until a condition becomes true
Your posts are moderated
Related Questions
#questiontypes of lines and how to draw

FILES IN A VB PROJECT The project file has the.vbp extension. The form in which we draw has the .frm extension; .mod denotes the module file; .cls denotes the class file; .res


The Document: The document contains the user's data. For illustration, after working on a text processor, the user may wish for to save the file. Such an action builds a docum

DDX - Dialog Data Exchange: The Data members can be related with specific controls in the dialog box. When the dialog box is displayed, the DDX will transfer the values into t

steps of connecting database from vb6.0

i need sample balance sheet form in vb.net

A variable is convenient placeholder which refers to a computer memory location where you can store program information which may change when your script is running. For instance,

The Dictionary object stores data as key, item pairs. A Dictionary object is the corresponding of a PERL associative array. Items, that can be any form of data, are stored in the a

A program needs to be written that is capable of simple image processing. All the images that are available for you to use, can be found on Blackboard in the Assignments section. T