| View previous topic :: View next topic |
| Author |
Message |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Wed Mar 12, 2008 10:03 am Post subject: [VB2008] How would I make a continuous loop .... |
|
|
How would I turn this code into a continuous loop.
| Code: |
Dim i As Integer
i = 0
For i = 1 To 5
MsgBox("Hi")
Next i
|
But what if I wanted that loop to only last until button2 is clicked?
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Wed Mar 12, 2008 10:11 am Post subject: |
|
|
i dont program VB myself, but i would guess, something like this would work:
first, make "i" an variabled, that can be readed from all over the program
then make the first button this:
| Quote: | i = 0
For i = 1 To 5
{
MsgBox("Hi")
i = 0
}
Next i |
and the second:
but once again, im not sure...[/quote]
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Mar 12, 2008 10:39 am Post subject: |
|
|
| While / Do While
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 12, 2008 2:31 pm Post subject: |
|
|
Use a timer or create a thread and have the button either turn it off or kill the thread?
_________________
- Retired. |
|
| Back to top |
|
 |
Michel Expert Cheater
Reputation: 0
Joined: 16 May 2007 Posts: 214 Location: The Netherlands
|
Posted: Wed Mar 12, 2008 2:35 pm Post subject: |
|
|
| If you use a timer, just add 'timer1.enabled := false; ' to the button..
|
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Wed Mar 12, 2008 2:43 pm Post subject: |
|
|
| kk I understand
|
|
| Back to top |
|
 |
|