1.Do Loop
|
O formato é como segue:
|
a) Do While condition
Block of one or more VB statements
Loop
b) Do
Block of one or more VB statements
Loop While condition
c) Do Until condition
Block of one or more VB statements
Loop
d) Do
Block of one or more VB statements
Loop Until condition
|
|
O seguinte exemplo mostra que o uso de do laços em VB
|
Do while counter <=1000
num.Text=counter
counter =counter+1
Loop
or
The above example can be rewritten as
Do
num.Text=counter
counter=counter+1
Loop until counter>1000
|
|
2.For....Next Loop
|
O formato é como segue:
|
For counter=startNumber to endNumber (Step increment)
One or more VB statements
Next
|
|
O seguinte exemplo mostra o uso de For...Next Loop seguinte em VB
|
(a) For counter=1 to 10
display.Text=counter
Next
(b) For counter=1 to 1000 step 10
counter=counter+1
Next
(c) For counter=1000 to 5 step -5
counter=counter-10
Next
|
|
Keywords:
Looping in VB,
visual basic looping,
asp net looping,
visual basic vb,
vb source code,
while loop in vb,
for loop in vb,
vb asp net,
looping in excel,
looping in sql,
vb array,
vb functions,
looping asp,
vb tutorials,
vb timer,
looping code,
vb dim,
vb code,
vb msgbox,
vb controls,
vb reference,
shell in vb
|