|
-
Aug 24th, 2010, 09:50 PM
#1
Thread Starter
Junior Member
I need help with something.
OK, I am making a game, pretty much you need to guess the time..sounds easy, and boring, but I am making it fun.
Pretty much if the exact time is 3:34:55 PM I want you to be able to guess 3:34:53 PM - 3:34:55 or 3:34:55 - 3:34:57 PM
Understand, this is what I have so far:
If TextBox1.Text = TimeOfDay Then
MsgBox("Correct!", 0 + 0, "You Win!")
End If
-
Aug 25th, 2010, 06:31 AM
#2
Re: I need help with something.
Try this
vb Code:
Dim dtTimeNow As DateTime
dtTimeNow = CDate(TextBox1.Text)
If dtTimeNow.AddSeconds(2) <= TimeOfDay AndAlso TimeOfDay >= dtTimeNow.AddSeconds(-2) Then
MessageBox.Show("You Win")
End If
-
Aug 25th, 2010, 06:35 AM
#3
Re: I need help with something.
Welcome to the forums and great title! Please can you make any more posts a bit more obvious as to what is in them .
For my addition to this thread, you can do a DateDiff method to tell your player how far away they are in seconds to the real time!
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
|