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

Running statements if a condition is true, To run only one statement while ...

To run only one statement while a condition is True, employ the single-line syntax for the If...Then...Else statement. The following instance shows the single-line syntax. Notice t

Storage and retrieval systems, STORAGE AND RETRIEVAL SYSTEMS   The sto...

STORAGE AND RETRIEVAL SYSTEMS   The storage system is a depository. It is a physical container and gives mechanisms to put in the depository and take them back. The retrieval

Executesql - database application, Executesql: The ExecuteSQL is used ...

Executesql: The ExecuteSQL is used for executing the query on the database. The CRecordset uses the RFX mechanism to replace data between field data members of the record set

Student record management system, i need your help in designing and coding ...

i need your help in designing and coding a student record management system

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

Vb script basics, This section will discuss the fundamentals of VBScript an...

This section will discuss the fundamentals of VBScript and define concepts such as datatypes, loops and others. VBScript Data Types VBScript contain only one data type called

Illustration of mdi application using a project, ILLUSTRATION OF MDI APPLIC...

ILLUSTRATION OF MDI APPLICATION USING A PROJECT 1. Choose the MDI option while generating the project by using the Appwizard. 2. Add the WM_LBUTTONDOWN message for the view

Help context property, Sets or returns context ID for topic in Help File. I...

Sets or returns context ID for topic in Help File. If Help file is indicated in the VBScript Err Object HelpFile Property, the HelpContext property is utilized to display automatic

Variable scope prefixes, Variable Scope Prefixes As script size rise, s...

Variable Scope Prefixes As script size rise, so does the value of being capable to rapidly differentiate the scope of variables. A one-letter scope prefix preceding type prefix

Software with inappropriate behavior - basics of gui design, Software With ...

Software With Inappropriate Behavior: You would save a document; print it, and then you'll try to close it. The program will ask you if you want to save. This is because; the

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