Visit the Ironworks Gaming Website Email the Webmaster Graphics Library Rules and Regulations Help Support Ironworks Forum with a Donation to Keep us Online - We rely totally on Donations from members Donation goal Meter

Ironworks Gaming Radio

Ironworks Gaming Forum

Go Back   Ironworks Gaming Forum > Ironworks Gaming Forums > General Discussion > General Conversation Archives (11/2000 - 01/2005)
FAQ Calendar Arcade Today's Posts Search

 
 
Thread Tools Search this Thread
Old 02-22-2003, 03:15 AM   #1
LennonCook
Jack Burton
 

Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 37
Posts: 5,452
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 ??
LennonCook is offline  
Old 02-22-2003, 05:32 AM   #2
andrewas
Harper
 

Join Date: October 2, 2001
Location: Aberdeen, Scotland
Age: 42
Posts: 4,774
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:
code:
For x = 0 to txt1.text DO
.
.
.
LOOP
[/QUOTE]
__________________
[img]\"http://www.sighost.us/members/Zvijer/andrewas.gif\" alt=\" - \" />
andrewas is offline  
Old 02-22-2003, 06:20 AM   #3
Night Stalker
Lord Ao
 

Join Date: June 24, 2002
Location: Nevernever Land
Age: 49
Posts: 2,002
The syntax is:

code:
for x = 0 to txt1.value (or .text)
.
.
select case y
case
condition
.
.
end select
.
.
next
[/QUOTE]
__________________
[url]\"http://www.duryea.org/pinky/gurkin.wav\" target=\"_blank\">AYPWIP?</a> .... <img border=\"0\" alt=\"[1ponder]\" title=\"\" src=\"graemlins/1ponder.gif\" /> <br />\"I think so Brain, but isn\'t a cucumber that small called a gherkin?\"<br /><br />Shut UP! Pinky!
Night Stalker is offline  
Old 02-22-2003, 07:11 AM   #4
andrewas
Harper
 

Join Date: October 2, 2001
Location: Aberdeen, Scotland
Age: 42
Posts: 4,774
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.
__________________
[img]\"http://www.sighost.us/members/Zvijer/andrewas.gif\" alt=\" - \" />
andrewas is offline  
Old 02-22-2003, 05:07 PM   #5
LennonCook
Jack Burton
 

Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 37
Posts: 5,452
Ok, so that will repeat the function for x times, where x = Val(txt1.text) ??
LennonCook is offline  
Old 02-23-2003, 01:58 PM   #6
Night Stalker
Lord Ao
 

Join Date: June 24, 2002
Location: Nevernever Land
Age: 49
Posts: 2,002
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.
__________________
[url]\"http://www.duryea.org/pinky/gurkin.wav\" target=\"_blank\">AYPWIP?</a> .... <img border=\"0\" alt=\"[1ponder]\" title=\"\" src=\"graemlins/1ponder.gif\" /> <br />\"I think so Brain, but isn\'t a cucumber that small called a gherkin?\"<br /><br />Shut UP! Pinky!
Night Stalker is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual BASIC Questions LennonCook General Conversation Archives (11/2000 - 01/2005) 7 10-21-2003 10:31 AM
Visual Basic Decompiter Intrepid General Conversation Archives (11/2000 - 01/2005) 6 09-04-2003 03:02 AM
(Yet Another) Visual BASIC Question LennonCook General Conversation Archives (11/2000 - 01/2005) 1 05-07-2003 07:59 AM
Anyone know Visual Basic 6 here? Jorath Calar General Conversation Archives (11/2000 - 01/2005) 1 11-24-2001 12:57 PM
Basic D & D question Mels Baldurs Gate II Archives 2 12-25-2000 10:56 AM


All times are GMT -4. The time now is 01:25 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved