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
INTRODUCTION TO DATABASE APPLICATIONS   In this section, we define a dialog and tab order that is the order in which the controls will be navigated during the execution. The D

create an application that performs the following operation with the employee file created by the application in programming challenge 1: uses an open dialog box to allow the user

Displaying the file Without Scrolling: To display a file follow the steps as shown below: 1. Generate a SDI application. 2. Type the coding as shown in the Serialize els

WINDOWS PROGRAMMING The Windows programming is a developing application using the C and the native Win32 application interface (API) or C++ and the class libraries like Microso


DYNAMIC LINK LIBRARY   The dynamic link library (dll) permits one copy of a function to be shared among some parallel executing programs. The dll is a file that contains a num

Write a program that permits the user to order a product from inventory. The user selects the product and enters the quantity. If there is sufficient quantity on hand of the produc

Methods: VBScript Dictionary Object Method D escription Add Method Adds a key, item pair. Exists Method

I have a tiff image of 25 pages. I capture particular square from particular page and past on one excel sheet one by one. it is possible, if yes how. Image have line no and pe

How to pull ordered menu from a cash till to database or display on a computer screen