Click here to Skip to main content
16,023,224 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a timer control from the toolbox in vs 2017.I am enabling the timer in load and disabling in some part of code.When i am seeing the status of timer enable/disable in Addwatch window,it is remaining always true even if its disable.Can anyone please help me out in this.

public partial class frmTimer : Form
{
public frmTimer()
{
InitializeComponent();
}

private void frmTimer_Load(object sender, EventArgs e)
{
tmrtest.Enabled=false ;
}

private void tmrtest_Tick(object sender, EventArgs e)
{
string test = "Testing the timer";
checkingtimersettings();
}

private void checkingtimersettings()
{
tmrtest.Enabled = false;
tmrtest.Interval = 1000;
//tmrtest.Enabled = true;
//tmrtest.Start();
}
}

What I have tried:

I tried giving delays by using sleep.even it is the same
Posted
Updated 10-Nov-19 22:20pm
Comments
phil.o 11-Nov-19 4:12am    
You are disabling the timer on form load. After that, the timer won't tick, and none of the code you have shown will actually execute.
[no name] 11-Nov-19 4:37am    
Please edit your question and show the actual code (properly formatted) with an enabled timer, and explain why it does not work.

1 solution

Sir even if i enable the timer in load that is tmrtest.enable=true and on disabling the status of timer it is not being updated.
 
Share this answer
 
Comments
Richard Deeming 12-Nov-19 11:46am    
To reply to a comment, click the "Reply" button next to that comment.

Do not post your reply as a "solution" to your question.

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