For each next loop - vbscript, Visual Basic Programming

A For Each...Next loop is similar to a For...Next loop. Rather than repeating the statements a particular number of times, For Each...Next loop repeats group of statements for each item in a collection of objects or for each element of an array. It is especially helpful if you do not know how several elements are present in a collection.

In the given HTML code example, the contents of any Dictionary object are utilized to place text in several text boxes:

HTML

HEAD TITLE Forms and Elements TITLE HEAD

SCRIPT LANGUAGE="VBScript"

 

Sub cmdChange_OnClick

Dim d                   'Create a variable

Set d = CreateObject("Scripting.Dictionary")

d.Add "0", "Athens"    

'Add some keys and items d.Add "1", "Belgrade"

d.Add "2", "Cairo"

a = d.items

For i = 0 To d.Count

document.frmForm.Elements(i).Value = a(i)

Next

End Sub

 

SCRIPT

BODY

CENTER

FORM NAME="frmForm"

Input Type = "Text"

Input Type = "Text"

Input Type = "Text"

Input Type = "Button" NAME="cmd Change" VALUE="Click Here"p

Posted Date: 4/18/2013 5:56:29 AM | Location : United States







Related Discussions:- For each next loop - vbscript, Assignment Help, Ask Question on For each next loop - vbscript, Get Answer, Expert's Help, For each next loop - vbscript Discussions

Write discussion on For each next loop - vbscript
Your posts are moderated
Related Questions
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

Function IsPalindrome(str) Dim iStart,iEnd,ctr,blnPalin str=trim(str) blnPalin=true iEnd=len(str) iCnt=round(iEnd / 2) iStart=1 for ctr=1 to cint(iCnt) if(mid(str,iEnd,

Mostly time, you just desire to assign a single value to a variable you have declared. A variable having a single value is a scalar variable. At other times, this is convenient to

Do While Loop Statement : The statements contained by the do...while loop block executes till the condition given in the while is true. The working of do...loop is elaborate

Device Contexts: The Device Context (DC) is represented by the data type Handle to Device Context (HDC). The HDC is a handle to somewhat you can draw on; it can be the whole s

Events: The Controls are placed on a form and then to make them functional an "event procedure" is related with the control object. An event process is what happens in respons

steps of connecting database from vb6.0

A For Each...Next loop is similar to a For...Next loop. Rather than repeating the statements a particular number of times, For Each...Next loop repeats group of statements for each

You can employ the SCRIPT element to add VBScript code to an HTML page. The SCRIPT Tag VBScript code is written inside paired SCRIPT tags. For instance, a process to test

Using Visual Studio 2010 C++ 1) Using Windows Explorer, make a copy of Irvine\examples\Project_sample folder in the folder where you keep your materials for this course.