Academic Tutorials



English | French | Portugese | German | Italian
Google

Home Source Codes E-Books Downloads Contact Us About Us

VB.NET
Introduction to VB.NET
Visual Basic Scripts
Variables and Data Types
Arrays and Collections
Arithmetic and String Operations
Relational and Logical Operations
Math and String Functions
Date and Time Functions
Display Formats
Subprograms
Functions
The If Statement
The If...Else Statement
The Else...If Statement
The Select...Case Statement
The For...Next Statement
The For Each...Next Statement
The While...End While Statement
The Do...Loop Statement

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


The Do...Loop Statement
Previous Next


A Do...Loop creates an iteration much like a While...End While loop and it offers the additional option of executing the statements in the loop at least one time.

Do [While|Until] condition

...statements

Loop

or

Do

...statements

Loop [While|Until] condition


In its Do While...Loop configuration the loop executes as long as a condition test at the beginning of the loop remains True and the condition may be False at the start of the loop, in which case the loop is exited before it begins. Somewhere inside the loop the condition becomes True for exiting the loop as in the case with the While...End While loop, the condition test is for continuing the loop.

In its Do Until...Loop configuration the condition test is for ending of the loop and in otherwords the logic is the same as for the Do While...Loop.

If there is a situation in which the statements in the loop will be executed at least one time, then the Do...While Loop or Do...Until Loop configuration can be used and the condition test is not made until the end of the loop, after that the statements have been executed the first time.

The Do...Loop presents special condition-test options that don't normally appear in routine data processing and for the most part, For...Next and While...End While statements can handle the bulk of processing. As an illustration, though, of the Do...Until Loop option and the following script loads the CodesArray and StatesArray arrays that are used in a previous example of the While...End While loop. To populate the arrays,it reads records from an external text file , then writes the information to this page.

<SCRIPT runat="server">

Dim StatesArray(0) As String
Dim CodesArray(0) As String

Sub Page_Load

Dim FileReader As StreamReader
Dim LineIn As String
Dim FieldArray() As String

FileReader = File.OpenText("e:\WebSite\tutorials\vbnet\vbnet04\StateCodes.txt")
LineIn = FileReader.ReadLine()
Do
FieldArray = Split(LineIn, ",")
StatesArray(UBound(StatesArray)) = FieldArray(0)
CodesArray(UBound(CodesArray)) = FieldArray(1)
LineIn = FileReader.ReadLine()
If LineIn <> ""
ReDim Preserve StatesArray(StatesArray.Length)
ReDim Preserve CodesArray(CodesArray.Length)
End If
Loop Until LineIn = ""
FileReader.Close()

Dim i As Integer
For i = 0 To UBound(StatesArray)
CodesOut.Text &= StatesArray(i) & ", " & CodesArray(i) & "<br/>"
Next

End Sub

</SCRIPT>

<div style="border:solid 1px; padding:10px; width:150px">
<asp:Label id="CodesOut" EnableViewState="False" runat="server"/>
</div>



Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previous Next

Keywords: The Do...Loop Statement in vb.net, while loop statement, for loop statement, select case statement, java statement, value statement, values statement, function statement, nested statement, command statement, case statement, switch statement, count statement, sql statement, condition statement


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.