Code causing access to hang! (1 Viewer)

agehoops

Registered User.
Local time
Today, 02:18
Joined
Feb 11, 2006
Messages
351
Can anyone see why this code is causing access to hang EVERY time I TRY and run it. It doesn't even run at all, just hangs outright.

Code:
i = -1000

Do Until i = 1000

Do Until Bar.Left = 5.529
  Bar.Left = Bar.Left + 0.001
Loop
   
Do Until Bar.Width = 0
  Bar.Width = Bar.Width - 0.001
Loop
 Bar.Left = 1.005
 Bar.Width = 0
 
Do Until Bar.Width = 1.005
 Bar.Width = Bar.Width + 0.001
Loop
i = i + 1
Loop
 

Dennisk

AWF VIP
Local time
Today, 02:18
Joined
Jul 22, 2004
Messages
1,649
I suspect this line is causing problems

Do Until Bar.Left = 5.529


As this is a floating point number you may never get a situation where you value is exactly 5.529.

As you are incrementing this value you should exit the loop when the value exceeds 5.529
 

agehoops

Registered User.
Local time
Today, 02:18
Joined
Feb 11, 2006
Messages
351
Surely I would get to that value if I'm adding 0.001 each time? It would have to get there wouldn't it?
 

Users who are viewing this thread

Top Bottom