Solved

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

Posted on 2004-09-10
6
1,551 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

710 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