Solved

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

Posted on 2004-09-10
6
1,570 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

623 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