Console App Theory

G

Guest

I have been struggling with a console app that I have written. Perhaps there are some gurus out there that can clear up a few things for me. My history is with VB where you have a form and a butt on and so on. When you click, load, change a control you can run some code with that event. I am hoping that I can translate that sort of functionality to a console app and eventually a service. I want to have, say, a timer control in my console app that runs a bit of code every 5 seconds. So the two questions are how do I start a console app and have it just"sit there" without using 100% cpu until some event fires. And secondly how do you "create" events in a console app? Specifically I am looking at the timer class and the udpclient class. Any thoughts and/or general direction is appreciated

Thanks
Dan
 
T

Tom Shelton

I have been struggling with a console app that I have written. Perhaps there are some gurus out there that can clear up a few things for me. My history is with VB where you have a form and a butt on and so on. When you click, load, change a control you can run some code with that event. I am hoping that I can translate that sort of functionality to a console app and eventually a service. I want to have, say, a timer control in my console app that runs a bit of code every 5 seconds. So the two questions are how do I start a console app and have it just"sit there" without using 100% cpu until some event fires. And secondly how do you "create" events in a console app? Specifically I am looking at the timer class and the udpclient class. Any thoughts and/or general direction is appreciated.

Thanks!
Dan

Use the formless timers... Either System.Threading.Timer or
System.Timers.Timer... Windows.Forms.Timer won't work for you, since
there is no message loop in a console app.

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
"Zaphod grinned two manic grins, sauntered over to the bar
and bought most of it."

- Zaphod in paradise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top