Results 1 to 3 of 3

Thread: I need help with something.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2010
    Posts
    24

    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

  2. #2
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Re: I need help with something.

    Try this

    vb Code:
    1. Dim dtTimeNow As DateTime
    2.         dtTimeNow = CDate(TextBox1.Text)
    3.         If dtTimeNow.AddSeconds(2) <= TimeOfDay AndAlso TimeOfDay >= dtTimeNow.AddSeconds(-2) Then
    4.             MessageBox.Show("You Win")
    5.         End If
    thanks
    amrita

  3. #3
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    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
  •  



Click Here to Expand Forum to Full Width