I want to create a small delay so that my 1st set of codes run smoothly.
How can I do that in vb.net ?
Edit 1
Suppose I have a few lines of code like this
..................Statement Line 1..............
..................Statement Line 2..............
..................Statement Line 3..............
..................Statement Line 1..............
..................Statement Line 5..............
WAIT UNTIL STATEMENT 5 IS COMPLETED
..................Statement Line 6..............
..................Statement Line 7..............
..................Statement Line 8..............
..................Statement Line 9..............
..................Statement Line 10.............
Only when the execution of first five statements are complete then only the next five can be executed
Are you looking to make a thread sleep?
Thread.Sleep(100);
Where 100 is the number of millisecond you want the thread to sleep for.
Also make sure to have Imports System.Threading, which I assume you have if you already have multiple threads.
EDIT: Okay, so you’ve added a bit of code. Still, this should come down to whether you have more than one thread running, and from your question it looks like it’s all in one thread. In this case, statement 5 will always finish first before statement 6 runs. That’s how code works. The only case where it wouldn’t would be if one of statements 1-5 spawns something on a new thread.