0

Hi

I need to have my c# code to update from microsoft access automatically. can i use the timer control?

This is the code i found for timer control:

public partial class Form1 : Form
    {
        Timer timer = new Timer();
        Label label = new Label();
        public Form1()
        {
            InitializeComponent();

            timer.Tick += new EventHandler(timer_Tick); 
            timer.Interval = (1000) * (5);              
            timer.Enabled = true;                       
            timer.Start();                             

            label.Location = new Point(100, 100);
            label.AutoSize = true;
            label.Text = String.Empty;

            this.Controls.Add(label);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }
        void timer_Tick(object sender, EventArgs e)
        {
            label.Text = DateTime.Now.ToString();
        }

    }

These just give me a textbox with the time clicking.

Can someone pls advise how can i use these to make my program update automatically?

Thanks

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by ddanbe
0

In your timer_Tick eventhandler, instead of updating the Text of a label, update your application or do anything else you like to do here.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.