Hello,
From Form1, I'm trying to Call a sub on Form2 that displays a countdown timer in a label.
First, I tried to it a different way by putting this code in Form1; above the sub "Dim tmrCD As Integer = 120" and code:
But it only displayed 119 and didn't count down. It was obvious to me that the reason is because the Timer is not being used.
Then I tried putting this into Form2
But it started counting down the instant the page loaded, which is completely opposite from what I need! I need Form1 to finish it's job when a button is pressed, THEN call Timer1_Tick at the bottom of the sub on Form1 when it's finished with it's job. In form1, I tried using:
But got the error:
Property access must assign to the property or use it's value.
I'm not sure how to proceed. Ideas?
From Form1, I'm trying to Call a sub on Form2 that displays a countdown timer in a label.
First, I tried to it a different way by putting this code in Form1; above the sub "Dim tmrCD As Integer = 120" and code:
Code:
tmrCD = tmrCD - 1
If tmrCD > 0 Then frmTwo.lblCD.Text = ("NEXT ATTEMPT STARTS IN " & tmrCD.ToString)
If frmTwo.lblCD.Text = "0" Then
frmTwo.Timer1.Stop()
End If
Then I tried putting this into Form2
Code:
Private CD As Integer = 120
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Me.lblCD.Text = ("NEXT ATTEMPT STARTS IN " & CD.ToString("00"))
If CD = 0 Then
Me.Timer1.Enabled = False
Else
CD -= 1
End If
End Sub
Code:
Call frmTwo.Timer1
Quote:
Property access must assign to the property or use it's value.