I'm learning VB.net so I decided to translate a couple easier things from VB6. This was a popular Wait() function used a lot in VB6, so I thought I could make it better AND put it into VB.net, so here we are. There is an easier way to do this, but since I'm learning I thought I'd give it a go 
How to use:
Value property (long): This is the time that the application will wait for.
Seconds property (boolean): Set to true to have the application wait for [value] in seconds, set to false to have it wait for [value] in milliseconds.
Code:
Public Declare Function timeGetTime Lib "winmm.dll" () As Long
Public Sub WaitEx(ByVal value As Long, ByVal seconds As Boolean)
On Error Resume Next
Dim cTime As Long
cTime = timeGetTime()
If seconds = True Then
Do
Application.DoEvents()
Loop While cTime + (value * 1000) > timeGetTime()
Else
Do
Application.DoEvents()
Loop While cTime + value > timeGetTime()
End If
End Sub
How to use:
Value property (long): This is the time that the application will wait for.
Seconds property (boolean): Set to true to have the application wait for [value] in seconds, set to false to have it wait for [value] in milliseconds.


















