Results 1 to 2 of 2

Thread: Alarm and Combo box!

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2008
    Posts
    33

    Alarm and Combo box!

    Hi guys!

    I have a combo box with these data...

    1*45minutes
    2*45minutes
    3*45minutes
    4*45minutes
    5*45minutes
    6*45minutes

    I have also a command button and a WindowsMediaPlayer. I would like when the user choose an option from combo box and then press the command button (OK) WindowsMediaPlayer will play a song after the minutes expire that user chose. For example something like that...

    If If Combo1.Text = "2*45minutes" Then
    WindowsMediaPlayer play a song after 90 minutes
    End if
    If If Combo1.Text = "3*45minutes" Then
    WindowsMediaPlayer play a song after 135 minutes
    End if

    And so on...

    I do know that i have to use a timer to do that but i dont know how!
    HELP ME GUYS!

    Thanks!

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Alarm and Combo box!

    On command click do this

    1. Save current date/time value using the Now function in a global variable
    2. Calculate the value in mintes based on combo selection and store in a global variable
    3. Enable the timer

    On the Timer's Timer event do this

    use DateDiff to calculate the difference in seconds between the saved time from above step 1 and current time. If it is equal or greater than the value in variable from step 2 (times 60 to be in seconds) start playing (and disable the timer)

    (in design mode, set the interval of the timer to 500, and set it to enabled = false)

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