Solved

C#: timer interval run-time user settings???????

Posted on 2004-09-10
6
1,488 Views
Last Modified: 2012-05-05
Q. How do you code a timer so a user can change the interval settings for a finished and running application???

I realize they would probably have to close and reopen the application for the settings to take effect..........

I tried this with complie errors:   timer1.Internal = txtBox1.Text
0
Comment
Question by:kvnsdr
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:Razzie_
ID: 12031259
If you use the System.Threading.Timer object, you can use the Timer.Change() method.

This method takes, for example, a TimeSpan object, when the timer should invoke it methods, and as a second parameter, when the timer should re-invoke its method.

If you're using another timer object, let me know.
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 12031897
I'm using a simple drag-n-drop Timer1 with VS C# .NET, no threading...........
0
 
LVL 5

Accepted Solution

by:
tzxie2000 earned 50 total points
ID: 12033199
please stop the timer and restart it like code below

timer1.stop();
timer1.Interval=Integer.Parse(txtBox1.Text);
timer1.start();
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:kvnsdr
ID: 12045381
Integer (type or reference could not be found, error)
0
 
LVL 5

Assisted Solution

by:tzxie2000
tzxie2000 earned 50 total points
ID: 12045407
sorry for that
please using int replaced Integer
as in delphi int is Integer
sorry for that
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 12045546
Thank you, the complete code is below for anyone else's use.

private void button1_Click(object sender, System.EventArgs e)
{
this.timer1.Stop();
this.timer1.Interval = int.Parse(textBox2.Text);
this.timer1.Start();
}
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now