Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += timer_Tick; // i take some error here. "Doesn't exist in the current context"
timer.Start();

I take errors about "timer.Tick += timer_Tick". What should I make there? Add some "using" words or what?
Thanks in advance.
Posted
Updated 10-Jul-13 3:13am
v2
Comments
[no name] 10-Jul-13 9:03am    
Did you create a timer_Tick method?

1 solution

Hi,

You should create a timer_Tick method:
C#
private void timer_Tick(object sender, EventArgs e)
{
     // your code here
}

If you add this method to your class, you don't longer get the "Doesn't exist in the current context" error.

Hope this helps.
 
Share this answer
 
Comments
berkayerdi 10-Jul-13 9:07am    
if i create object is this no error?
Thomas Daniels 10-Jul-13 9:07am    
If you create the method, then you'll get no error.
berkayerdi 10-Jul-13 9:12am    
thanks
Thomas Daniels 10-Jul-13 9:12am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900