timer control

Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2009
Posts: 12
Reputation: dip7 is an unknown quantity at this point 
Solved Threads: 0
dip7 dip7 is offline Offline
Newbie Poster

timer control

 
0
  #1
May 21st, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,056
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 312
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Postaholic

Re: timer control

 
0
  #2
May 21st, 2009
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.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum


Views: 797 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC