![]() |
<font color="lightblue">Is it possible to tell VB to repeat an action x times, based on user input ??
As in, have 1 select statement, and tell VB to run it Val(txt1.Text) times ?? </font> |
FOR statement. I cant remember the precise syntax (go download Delphi or C++ or somethings *sophisticaed* will you) but its something along the lines of:
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">For x = 0 to txt1.text DO . . . LOOP</pre>[/QUOTE] |
The syntax is:
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">for x = 0 to txt1.value (or .text) . . select case y case condition . . end select . . next</pre>[/QUOTE] |
Ah yes, FOR..NEXT. havent used BASIC in far too long.
You can also use a WHILE or UNTIL statement, but FOR is the best in this instance. The others are more versatile though. Learn em all, programming without loops gets painful. |
<font color="lightblue">Ok, so that will repeat the function for x times, where x = Val(txt1.text) ?? </font>
|
you won't need the val function. VB does implicit type conversions. You can use any control for input, you are not restriced to text boxes.
Oooppps I'm sorry. Your loop will run x+1 times. Change for x = 0 to for x=1. That will run x times. |
All times are GMT -4. The time now is 01:42 PM. |
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved