Freeze a Form of VB6 using timer control

vb6 , Timer Control , Countdown in VB 6 India
  • 11 years ago
    Private Sub Command1_Click()
    Timer1.Enabled = Not Timer1.Enabled
    Command1.Caption = IIf(Timer1.Enabled, "Stop", "Start")
    Command1.Visible = False
    

    End Sub

    Private Sub Command2_Click() Form2.Hide Form1.Show End Sub

    Private Sub Form_Load() Timer1.Interval = 1000 Timer1.Enabled = False Command1.Caption = "Start" txtmin.Text = " ": txtsec.Text = " ": txthour.Text = " "

    End Sub

    Private Sub Timer1_Timer() If Val(txtsec.Text) > 0 Or Val(txtmin.Text) > 0 Or Val(txthour.Text) > 0 Then If txtmin.Text = 0 And txthour.Text > 0 Then _ txtmin.Text = 60: txthour.Text = txthour.Text - 1 If txtsec.Text = 0 And txtmin.Text > 0 Then _ txtsec.Text = 60: txtmin.Text = txtmin.Text - 1 txtsec.Text = txtsec.Text - 1

         End If
         Me.WindowState = vbMinimized
         End Sub
    

    Private Sub txthour_Change() If Val(txthour.Text) > 4 Then txthour.Text = " " End If End Sub

    Private Sub txtmin_Change() If Val(txtmin.Text) > 60 Then txtmin.Text = " " End If End Sub

    Private Sub txtsec_Change() If Val(txtsec.Text) > 60 Then txtsec.Text = " " End If End Sub

    Here I have written a code to make a countdown.... Now I want to do ,when the timer will stop,Form1.frm will load automatically closing Form2. So what portion of my code need the modification.... Plz give me the code.....

  • 11 years ago
    Private Sub Command1_Click()
    Timer1.Enabled = Not Timer1.Enabled
    Command1.Caption = IIf(Timer1.Enabled, "Stop", "Start")
    Command1.Visible = False
    

    End Sub

    Private Sub Command2_Click() Form2.Hide Form1.Show End Sub

    Private Sub Form_Load() Timer1.Interval = 1000 Timer1.Enabled = False Command1.Caption = "Start" txtmin.Text = " ": txtsec.Text = " ": txthour.Text = " "

    End Sub

    Private Sub Timer1_Timer() If Val(txtsec.Text) > 0 Or Val(txtmin.Text) > 0 Or Val(txthour.Text) > 0 Then If txtmin.Text = 0 And txthour.Text > 0 Then _ txtmin.Text = 60: txthour.Text = txthour.Text - 1 If txtsec.Text = 0 And txtmin.Text > 0 Then _ txtsec.Text = 60: txtmin.Text = txtmin.Text - 1 txtsec.Text = txtsec.Text - 1

         End If
         Me.WindowState = vbMinimized
         End Sub
    

    Private Sub txthour_Change() If Val(txthour.Text) > 4 Then txthour.Text = " " End If End Sub

    Private Sub txtmin_Change() If Val(txtmin.Text) > 60 Then txtmin.Text = " " End If End Sub

    Private Sub txtsec_Change() If Val(txtsec.Text) > 60 Then txtsec.Text = " " End If End Sub

    Here I have written a code to make a countdown.... Now I want to do ,when the timer will stop,Form1.frm will load automatically closing Form2. So what portion of my code need the modification.... Plz give me the code.....

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay