|
-
Jan 26th, 2004, 03:41 PM
#1
Thread Starter
Fanatic Member
Wait Function
How do I create a function that waits (up to 2 hours)?
-
Jan 26th, 2004, 04:18 PM
#2
Why do you need it to wait? There are a ton of ways to do this. The built in timer in the .NET framework would probably be the easyest solution. You could also throw some code into a loop and don't let it leave until it's 2 hours later, but that would be CPU intensive.
-
Jan 26th, 2004, 04:24 PM
#3
Thread Starter
Fanatic Member
I need to pause an application for a two hour period. I am building a command line app, so how do I implement the timer control...? Thanks
-
Jan 26th, 2004, 04:45 PM
#4
Thread Starter
Fanatic Member
-
Jan 26th, 2004, 04:51 PM
#5
If it doesn't need to be doing anything in the background then just use Threading.Thread.CurrentThread.Sleep(#ofmilliseconds that equal 2 hours)
-
Jan 26th, 2004, 04:55 PM
#6
Thread Starter
Fanatic Member
Ed! How's it my man? Anyway, I placed this syntax in...
System.Threading.Thread.CurrentThread.Sleep(5000);
And got this error when I tried to compile....
C:\_root\c#\WOL\wol\sql.cs(32): Preprocessor directives must appear as the first non-whitespace character on a line
-
Jan 26th, 2004, 05:17 PM
#7
Hey there!
I'm not sure what the whitespace business is, make sure you have it within a method call of some kind.
Although on second glance it appears that the thread object doesn't have a sleep function in C# only in VB.NET.
Wait I guess it does but as a shared only method try this:
System.Threading.Thread.Sleep(1000);
Last edited by Edneeis; Jan 26th, 2004 at 05:21 PM.
-
Jan 26th, 2004, 05:39 PM
#8
Thread Starter
Fanatic Member
As usual, you're the man...Worked great....Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|