|
-
Nov 5th, 2000, 12:51 AM
#1
Thread Starter
Junior Member
I have been writing this code and i can't seem to get it to work. The form contains a line and a timer. I can't get it out of the constant loop. If anyone can help it would be greatly appreciated.
The Code is like this:
General declarations
Option Explicit
Dim x1
Dim x2
Dim y1
Dim y2
Dim R
Dim G
Dim B
Dim intcount As Integer
Public Sub Intervals()
Dim make
Dim go
make = Timer
Do Until go >= make + 0.14
go = Timer
Loop
End Sub
Private Sub Command1_Click()
timer1.Enabled = True
End Sub
Private Sub Command2_Click()
timer1.Enabled = False
End Sub
Private Sub timer1_Timer()
R = Int(240 * Rnd)
G = Int(240 * Rnd)
B = Int(240 * Rnd)
Do Until timer1.Enabled = False
Randomize
Line1.BorderColor = Int(RGB(R, G, B * Rnd))
Line1.x1 = Int(Form1.Width * Rnd) + 1
Line1.y1 = Int(Form1.Height * Rnd) + 1
Line1.x2 = Int(Form1.Width * Rnd) + 1
Line1.y2 = Int(Form1.Height * Rnd) + 1
Intervals
Cls
Loop
timer1.Enabled = False
End Sub
Thank you!!!
-
Nov 5th, 2000, 01:53 AM
#2
Fanatic Member
The following line produces an indefinete loop...
Code:
...
Do Until timer1.Enabled = False
Randomize
Line1.BorderColor = Int(RGB(R, G, B * Rnd))
Line1.x1 = Int(Form1.Width * Rnd) + 1
Line1.y1 = Int(Form1.Height * Rnd) + 1
Line1.x2 = Int(Form1.Width * Rnd) + 1
Line1.y2 = Int(Form1.Height * Rnd) + 1
Intervals
Cls
Loop
...
what it need is that the timer1.enabled = false be inside the loop for the loop to be effective
example:
right before the 'Cls' you should put an if statement that checks to see if whatever ur trying to do happens so that you can place inside the code if timer1.enabled = true or false;
Code:
If something happens Then
Timer1.Enabled = False
End If
Hope that helps... msg me if it doesnt...
-
Nov 5th, 2000, 11:06 AM
#3
Thread Starter
Junior Member
I tried this to a certain extent. I must be using the wrong event inside th if then statement. I can't really figure it out yet. Any hints?? Thanks
-
Nov 5th, 2000, 09:33 PM
#4
transcendental analytic
The event wont ever get fired since you won't let it.
Put a doevents in the interval loop
Code:
Do Until go >= make + 0.14
go = Timer
Doevents
Loop while forms.count 'avoid hang up if you close your app while in the loop
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|