ARTICLE

Timer Control in VB.NET

Posted by Sapna Articles | Visual Basic Language July 19, 2010
In this article you will learn how timer control works in VB.NET.
 
Reader Level:

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Difficulty: Easy
Instructions

Things You'll Need:

  • VB.net
  1. Step 1

    Open VB.net and create a new windows application.

  2. Step 2
    Listbox
     
    Listbox

    Add a listbox to the form. We are going to use the listbox to add items to it every time the timer control gets exceuted.

  3. Step 3
    Timer Control
     
    Timer Control

    Add the timer control to your form. Notice how the timer control is not actually shown on the form but instead in a different panel at the bottom.

  4. Step 4
    Timer Properties
     
    Timer Properties

    Click on the timer control and press the F4 key to bring up the timer's property window.

  5. Step 5
    Enabled Property
     
    Enabled Property

    Change the timer's enabled property from false to true.

  6. Step 6
    Interval Property
     
    Interval Property

    Chaneg the timer's interval property to 1000 which is about one second.

  7. Step 7
    Tick event
     
    Tick event

    Double click the timer control to bring up the timer's tick event.

  8. Step 8
    Code
     
    Code

    In the tick event we are going to add the code:
    ListBox1.Items.Add(ListBox1.Items.Count)

    What this does is add to our listbox the number of items in the listbox each time the tick event executes which we set earlier to 1000 or about every second.

  9. Step 9

    Run the program by pressing the F5 key on your keyboard.

  10. Step 10
    Final Results
     
    Final Results

    Notice how the numbers get added to the listbox.



Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html#ixzz0tsjQAbHR
 

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Difficulty: Easy
Instructions

Things You'll Need:

  • VB.net
  1. Step 1

    Open VB.net and create a new windows application.

  2. Step 2
    Listbox
     
    Listbox

    Add a listbox to the form. We are going to use the listbox to add items to it every time the timer control gets exceuted.

  3. Step 3
    Timer Control
     
    Timer Control

    Add the timer control to your form. Notice how the timer control is not actually shown on the form but instead in a different panel at the bottom.

  4. Step 4
    Timer Properties
     
    Timer Properties

    Click on the timer control and press the F4 key to bring up the timer's property window.

  5. Step 5
    Enabled Property
     
    Enabled Property

    Change the timer's enabled property from false to true.

  6. Step 6
    Interval Property
     
    Interval Property

    Chaneg the timer's interval property to 1000 which is about one second.

  7. Step 7
    Tick event
     
    Tick event

    Double click the timer control to bring up the timer's tick event.

  8. Step 8
    Code
     
    Code

    In the tick event we are going to add the code:
    ListBox1.Items.Add(ListBox1.Items.Count)

    What this does is add to our listbox the number of items in the listbox each time the tick event executes which we set earlier to 1000 or about every second.

  9. Step 9

    Run the program by pressing the F5 key on your keyboard.

  10. Step 10
    Final Results
     
    Final Results

    Notice how the numbers get added to the listbox.



Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html#ixzz0tsjQAbHR
 

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Difficulty: Easy
Instructions

Things You'll Need:

  • VB.net
  1. Step 1

    Open VB.net and create a new windows application.

  2. Step 2
    Listbox
     
    Listbox

    Add a listbox to the form. We are going to use the listbox to add items to it every time the timer control gets exceuted.

  3. Step 3
    Timer Control
     
    Timer Control

    Add the timer control to your form. Notice how the timer control is not actually shown on the form but instead in a different panel at the bottom.

  4. Step 4
    Timer Properties
     
    Timer Properties

    Click on the timer control and press the F4 key to bring up the timer's property window.

  5. Step 5
    Enabled Property
     
    Enabled Property

    Change the timer's enabled property from false to true.

  6. Step 6
    Interval Property
     
    Interval Property

    Chaneg the timer's interval property to 1000 which is about one second.

  7. Step 7
    Tick event
     
    Tick event

    Double click the timer control to bring up the timer's tick event.

  8. Step 8
    Code
     
    Code

    In the tick event we are going to add the code:
    ListBox1.Items.Add(ListBox1.Items.Count)

    What this does is add to our listbox the number of items in the listbox each time the tick event executes which we set earlier to 1000 or about every second.

  9. Step 9

    Run the program by pressing the F5 key on your keyboard.

  10. Step 10
    Final Results
     
    Final Results

    Notice how the numbers get added to the listbox.



Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html#ixzz0tsjQAbHR
 

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Difficulty: Easy
Instructions

Things You'll Need:

  • VB.net
  1. Step 1

    Open VB.net and create a new windows application.

  2. Step 2
    Listbox
     
    Listbox

    Add a listbox to the form. We are going to use the listbox to add items to it every time the timer control gets exceuted.

  3. Step 3
    Timer Control
     
    Timer Control

    Add the timer control to your form. Notice how the timer control is not actually shown on the form but instead in a different panel at the bottom.

  4. Step 4
    Timer Properties
     
    Timer Properties

    Click on the timer control and press the F4 key to bring up the timer's property window.

  5. Step 5
    Enabled Property
     
    Enabled Property

    Change the timer's enabled property from false to true.

  6. Step 6
    Interval Property
     
    Interval Property

    Chaneg the timer's interval property to 1000 which is about one second.

  7. Step 7
    Tick event
     
    Tick event

    Double click the timer control to bring up the timer's tick event.

  8. Step 8
    Code
     
    Code

    In the tick event we are going to add the code:
    ListBox1.Items.Add(ListBox1.Items.Count)

    What this does is add to our listbox the number of items in the listbox each time the tick event executes which we set earlier to 1000 or about every second.

  9. Step 9

    Run the program by pressing the F5 key on your keyboard.

  10. Step 10
    Final Results
     
    Final Results

    Notice how the numbers get added to the listbox.



Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html#ixzz0tsjQAbHR
 

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Difficulty: Easy
Instructions

Things You'll Need:

  • VB.net
  1. Step 1

    Open VB.net and create a new windows application.

  2. Step 2
    Listbox
     
    Listbox

    Add a listbox to the form. We are going to use the listbox to add items to it every time the timer control gets exceuted.

  3. Step 3
    Timer Control
     
    Timer Control

    Add the timer control to your form. Notice how the timer control is not actually shown on the form but instead in a different panel at the bottom.

  4. Step 4
    Timer Properties
     
    Timer Properties

    Click on the timer control and press the F4 key to bring up the timer's property window.

  5. Step 5
    Enabled Property
     
    Enabled Property

    Change the timer's enabled property from false to true.

  6. Step 6
    Interval Property
     
    Interval Property

    Chaneg the timer's interval property to 1000 which is about one second.

  7. Step 7
    Tick event
     
    Tick event

    Double click the timer control to bring up the timer's tick event.

  8. Step 8
    Code
     
    Code

    In the tick event we are going to add the code:
    ListBox1.Items.Add(ListBox1.Items.Count)

    What this does is add to our listbox the number of items in the listbox each time the tick event executes which we set earlier to 1000 or about every second.

  9. Step 9

    Run the program by pressing the F5 key on your keyboard.

  10. Step 10
    Final Results
     
    Final Results

    Notice how the numbers get added to the listbox.



Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html##ixzz0tsjQAbHR
 

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html##ixzz0tsk1mGru
 

The Timer Control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.NET.

Step1:    Open VB.Net and create a new windows application.

Step2:    Add  a listbox to the form. We are going to use the listbox to additems to it every timer control gets executed.

Step3:    Add the timer control to your form. Notice how the timer control is not shown on the form but instead in a different panel at the bottom.

ll1.gif

           ll9.gif

Step4:    Click on the timer control and press the F4 key to bring up the timer's property window , change the timer's enabled property from false to true and also change the timer's interval property to 1000 which is about one second.

Step5:    Double click the timer control to bring up the timer's tick event. In the tick event we are going to add the code:             

Public Class Form1
   Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  ListBox1.Items.Add(ListBox1.Items.Count)
   End Sub

End
Class
                
What this does is add to our listbox the number of items in the listbox each time the tick event executes which we set earlier to 1000 or every second.


Step6:    Run the program by pressing F5 keyword on your keyboard and notice how the numbers get added to the listbox. With the help of the scroll bar you can see the numbers till end. 

The timer control allows you to set specific time intervals until some code has to be executed. Here is how you program the timer control in VB.net

Read more: How to Program the Timer Control in VB.net | eHow.com http://www.ehow.com/how_4590003_program-timer-control-vbnet.html##ixzz0tsk1mGru
 

timer.gif

Login to add your contents and source code to this article
share this article :
post comment
 

iread your article,is simple and easy to understand.thanx

Posted by vincent mapalala Nov 27, 2010
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor