visual basic for loop
For counter [ As datatype ] = start To end [ Step step ]
[ statements ]
[ Continue For ]
[ statements ]
[ Exit For ]
[ statements ]
Next [ counter ]
4.2
5
' For VBA//VB/Visual Basic only
' ================================================================
' METHOD: FUNDAMENTAL
'EXAMPLE
Dim iTotalPrints As Integer
iTotalPrints = 5
For iCount = 1 To iTotalPrints
MsgBox Prompt:=iCount, Title:="Method: Fundamental"
Next
'SYNTAX
' For <your-variable-to-be-used> = <first-number> To <last-number>
' 'Code that uses <your-variable-to-be-used>
' Next
' ================================================================
' METHOD: WITHIN AN ARRAY
'EXAMPLE
Dim sTextList(4) As String 'Note: doesn't have to be of "String" data-type
sTextList(0) = "aaa"
sTextList(1) = "bbb"
sTextList(2) = "ccc"
sTextList(3) = "ddd"
sTextList(4) = "eee"
For Each sSeparateText In sTextList
MsgBox Prompt:=sSeparateText, Title:="Method: Within an Array"
Next
'SYNTAX
' For Each <your-variable-to-be-used> In <your-array-of-texts>
' 'Code that uses <your-variable-to-be-used>
' Next
Thank you!
5
0
Are there any code examples left?
New code examples in category BASIC
-
BASIC 2022-03-27 19:45:10 JWT EM VBNET
-
BASIC 2022-03-20 08:40:02 get unique random number in vb.net
-
BASIC 2022-03-05 09:25:09 token em vbnet incluido no header da requisição
-
BASIC 2022-03-03 05:25:02 dos/cmd equivalent to "head"
-
BASIC 2022-02-26 21:20:04 mid visual basic function
-
BASIC 2022-02-23 03:15:02 vscode unindent
-
BASIC 2022-02-18 17:20:01 freecodecamp basic algorithm scripting return largest numbers in arrays
-
BASIC 2022-02-10 16:10:40 visual basic how to create a dynamic button
-
BASIC 2022-02-04 21:30:23 tmux basic commands