Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Question...


Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2004, 06:46 AM
Wah-Wah Wah-Wah is offline
Newcomer
 
Join Date: Nov 2003
Location: Finland
Posts: 19
Post Question...


Is there a command that makes a pause during a sub?

Like if you say the command in the sub, and you enter a some sord of time value like "1", (one second), it will not go to the next command in line, until 1 second has passed...
Reply With Quote
  #2  
Old 02-07-2004, 06:58 AM
HarvestR's Avatar
HarvestR HarvestR is offline
Junior Contributor
 
Join Date: Jan 2004
Location: France
Posts: 292
Default

Quote:
Originally Posted by Wah-Wah
Is there a command that makes a pause during a sub?

Like if you say the command in the sub, and you enter a some sord of time value like "1", (one second), it will not go to the next command in line, until 1 second has passed...



You can use the GetTickCount API :

in a Module :

Code:
'API déclare Public Declare Function GetTickCount Lib "kernel32.dll" () As Long 'WAIT Function Public Function Wait(ByVal TimeToWait As Long) 'Time In seconds Dim EndTime As Long EndTime = GetTickCount + TimeToWait * 1000 '* 1000 Cause u give seconds and GetTickCount uses Milliseconds Do Until GetTickCount > EndTime DoEvents Loop End Function

In your Sub Code :

Code:
' ... Wait 1 'Wait for 1 second ' ...
Reply With Quote
  #3  
Old 02-07-2004, 07:12 AM
Wah-Wah Wah-Wah is offline
Newcomer
 
Join Date: Nov 2003
Location: Finland
Posts: 19
Default

Where do I put this?:

'API déclare
Public Declare Function GetTickCount Lib "kernel32.dll" () As Long


I gives me some sord of error.....
Reply With Quote
  #4  
Old 02-07-2004, 07:16 AM
Wah-Wah Wah-Wah is offline
Newcomer
 
Join Date: Nov 2003
Location: Finland
Posts: 19
Default

It says:

Compile error:

Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules
Reply With Quote
  #5  
Old 02-07-2004, 07:19 AM
HarvestR's Avatar
HarvestR HarvestR is offline
Junior Contributor
 
Join Date: Jan 2004
Location: France
Posts: 292
Default

Quote:
Originally Posted by Wah-Wah
It says:

Compile error:

Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules



If you put the code I gave you in a Form code, then change Public to Private in the code.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Next Question in Database WhIsPeRs Database and Reporting 5 06-29-2003 05:45 PM
VB Question falcon1 File I/O and Registry 27 06-27-2003 02:21 PM
Back button zukester General 31 08-15-2001 12:05 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->