Loop statement from inside the loop, Visual Basic Programming

Assignment Help:

You can exit a Do...Loop using the Exit Do statement. Since usually you desire to exit only in certain situations, such as to ignore an endless loop, you should employ the Exit Do statement in the True statement block of an If...Then...Else statement. If condition is False, the loop runs as usual. Or else, you probably did not require a loop in the first place.

In the following instance, myNum is assigned a value which creates an endless loop. The If...Then...Else statement verify for this condition, stop the endless repetition.

Sub ExitExample()

Dim counter, myNum counter = 0

myNum = 9

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

If myNum < 10 Then Exit Do

Loop

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


Related Discussions:- Loop statement from inside the loop

Illustration of ccolordialog, ILLUSTRATION OF CCOLORDIALOG The construc...

ILLUSTRATION OF CCOLORDIALOG The constructor of the CColorDialog takes the initial parameter as the default color and the next parameter specifies how much the dialog is displa

Variable naming conventions, For reason of readability & consistency, emplo...

For reason of readability & consistency, employ the following prefixes along with descriptive names for variables in your VBScript code. S ub type Prefi

Looping, how to make logic of o program and how to use loop

how to make logic of o program and how to use loop

Introduction to controls and toolbars, INTRODUCTION TO CONTROLS AND TOOLBAR...

INTRODUCTION TO CONTROLS AND TOOLBARS The Visual Basic programming is an event driven programming. In the form objects the termed controls are placed. We can put the properties

Visual interface design, VISUAL INTERFACE DESIGN Instead of the graphic...

VISUAL INTERFACE DESIGN Instead of the graphic nature of the program, only the visualness of the inter action is important. The program must not focus on the GUI. On the other

Program to order a product from inventory, Write a program that permits the...

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

Repeating a statement until a condition becomes true, You can employ until ...

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 Chk

Module - dialog box in visual basic, MODULE The Modules are the collect...

MODULE The Modules are the collection of VB statements. Modules are used to simplify the program development. To add a module to your project, choose the project tabpage, and t

Gdi objects, GDI OBJECTS   The CDC provides 5 versions for the GDI obj...

GDI OBJECTS   The CDC provides 5 versions for the GDI objects. They are fonts, brushes, pens, bitmaps and regions. The Select Object function substitutes the current GDI objec

Object naming conventions, The following table lists suggested conventions ...

The following table lists suggested conventions for objects you might encounter while programming VBScript. Code Commenting Conventions All process should begin with a brie

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd