.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Add New Timer & Its Tick Event At Runtime

Posted By:Ghanashyam Nayak       Posted Date: December 04, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

Code for add new timer & its tick event at button click event runtime...

Private Sub MyTimer() Dim Timer1 As New Timer() 'Add tick handler of new timer... AddHandler Timer1.Tick, AddressOf Timer1_Tick 'Tick Event interval of 1 Second... Timer1.Interval = 1000 'Start The timer... Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal obj As Object, ByVal e As EventArgs) 'Display current time in lable... lblTime.Text = Date.Now.ToString End Sub Private Sub MyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyButton.Click MyTimer() End Sub


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend