Hi,
Find the answer below using VB (I have updated my code as per Shahin Khorshidnia)
Please create
label (Set name as lblText) &
Button (Set name as btClick)
Public Class TimerApplication
Private Shared WithEvents myTimer As New System.Windows.Forms.Timer()
Private Shared alarmCounter As Integer = 1
Private Shared exitFlag As Boolean = False
'This is the method to run when the timer is raised.
Private Shared Sub TimerEventProcessor(ByVal myObject As Object, _
ByVal myEventArgs As EventArgs) _
Handles myTimer.Tick
myTimer.Stop()
exitFlag = True
End Sub
'Button click event
Private Sub btClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btClick.Click
lblText.Text = ""
myTimer.Interval = 10000
myTimer.Start()
' Runs the timer, and raises the event.
While exitFlag = False
' Processes all the events in the queue.
Application.DoEvents()
End While
'Print the lable value after 10 seconds
lblText.Text = "Ready"
End Sub
End Class