Start New Discussion within our Software Development Community

Hi all again im like a bug in the web xD never stop posting
i got this from other web

Private alarmTime As Date

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.alarmTime = Date.Now.AddMinutes(60)
        Me.Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If alarmTime < Date.Now Then
            Me.Timer1.Stop()
            MessageBox.Show("Time's up.")
        Else
            Dim remainingTime As TimeSpan = Me.alarmTime.Subtract(Date.Now)

            Me.Textbox1.Text = String.Format("{0}:{1:d2}:{2:d2}", _
                                           remainingTime.Hours, _
                                           remainingTime.Minutes, _
                                           remainingTime.Seconds)
        End If
    End Sub

Ok like you see this part

Me.alarmTime = Date.Now.AddMinutes(60)

60 only and i cant change it by button cuz i dont know how
so how i make like when Button3 is clicked it will put 60 min
and if Button4 is clicked then it puts 30min

like adding

if is 60 min it will be like 0:59:59 and if button4 is clicked too it will be 1:29:59 or something like that

The question is How Can i do that ? XD

Add a Counter which will be comprised of a button, and multiplying this value with yours and you will get the result I suppose that you wanted

Me.alarmTime = Date.Now.AddMinutes(60 * ButtonClickCounter)


It is a mine of ideas, may some have a better

This article has been dead for over six months. Start a new discussion instead.