[RESOLVED] Stop the cycle FOR for input
Hi. How could I stop a cycle FOR for input. For example:
FOR x=1 to 100
do something
stop for input some value into a textbox (a window will appear lets say and the user must insert some value)
resume (the user will click a button to resume the cycle FOR)
NEXT
Thank you very much. :confused:
Re: Stop the cycle FOR for input
You can use the EXIT FOR:
Code:
FOR x = 1 to 100
'do something
If some_condition Then
Exit For
End if
NEXT
Re: Stop the cycle FOR for input
I do not want to leave the FOR cycle
During its execution I want the user to input some values. A small window will appear and the user will have to input a value to the program. So
FOR x=1 to 100
the user will have to give value to the program for 100 times
NEXT
Re: Stop the cycle FOR for input
An input box will halt execution of the loop;
Code:
Dim X, A$
For X = 1 To 5
A$ = InputBox("Prompt for the information required")
'Do something with the info
Next X
Re: Stop the cycle FOR for input
Code:
For x = 1 To 100
Text1.Text = InputBox("Enter a value")
Next
Re: Stop the cycle FOR for input
If you need more flexibility than an inputbox gives you, you can open any form modally:
frmSomeForm.Show vbModal, Me
This will suspend execution until the modal form closes.
Re: Stop the cycle FOR for input
Perhaps your title "Stop the cycle FOR for input" confused me... :confused:
Re: Stop the cycle FOR for input
Thank you all for your help. It is working fine now. Maybe the name of this thread was a little confusing. Sorry. Thanks again!