run this code 1000 milliseconds from now...
whats the simplest way to do this in the middle of your code:
in 1000 milliseconds do this:
....
until then, continue normally with the rest of the code.
?
i can use a timer, and make it destray itself after it executes the first time, but that seems silly. is there a better way?
Re: run this code 1000 milliseconds from now...
Quote:
Originally posted by marvinklein
whats the simplest way to do this in the middle of your code:
in 1000 milliseconds do this:
....
until then, continue normally with the rest of the code.
?
i can use a timer, and make it destray itself after it executes the first time, but that seems silly. is there a better way?
I don't see the point of such a small delay, even in a game let alone a commercial application.
It depends on the code you want to keep running. Could you not enclose the code you want to run within a loop. Immediately before the loop is entered
Dim dTime as datetime = Now
Inside the loop
If Now>dTime.AddMilliseconds(1000) Then
(Code to do this)
End If
If you want to continue with the same code inside the loop without the delay, use a boolean to avoid this segment.