Click here to Skip to main content
15,891,375 members
Home / Discussions / C#
   

C#

 
QuestionCustom Server Controls (Restrict Defaults) Pin
tranzformerz2-Aug-07 11:24
tranzformerz2-Aug-07 11:24 
AnswerRe: Custom Server Controls (Restrict Defaults) Pin
pmarfleet2-Aug-07 12:15
pmarfleet2-Aug-07 12:15 
GeneralRe: Custom Server Controls (Restrict Defaults) Pin
tranzformerz2-Aug-07 12:37
tranzformerz2-Aug-07 12:37 
GeneralRe: Custom Server Controls (Restrict Defaults) Pin
pmarfleet2-Aug-07 12:47
pmarfleet2-Aug-07 12:47 
GeneralRe: Custom Server Controls (Restrict Defaults) Pin
tranzformerz2-Aug-07 13:17
tranzformerz2-Aug-07 13:17 
QuestionInvisible countdown? Pin
jafingi2-Aug-07 9:39
jafingi2-Aug-07 9:39 
AnswerRe: Invisible countdown? Pin
Tarakeshwar Reddy2-Aug-07 9:48
professionalTarakeshwar Reddy2-Aug-07 9:48 
AnswerRe: Invisible countdown? Pin
Luc Pattyn2-Aug-07 9:59
sitebuilderLuc Pattyn2-Aug-07 9:59 
Hi,

you would use some kind of timer:
- if the periodic function is lightweight and needs to access the GUI (assuming
a Windows app), the easiest solution is a Windows.Forms.Timer
- if the periodic function takes more than say 50 msec, you should use
a Timers.Timer or Threading.Timer; it will execute its handler on a different
thread, hence not blocking the GUI. But if it also needs to access the GUI,
you will have to use the Control.InvokeRequired and Control.Invoke() pattern.

Just one example.
somewhere, maybe in the form's constructor:
Windows.Forms.Timer timer=new Windows.Forms.Timer();
timer.Interval=60000; // that's about one minute
timer.Tick+=new EventHandler(timer_Tick);
timer.Start();

And this is the method that will execute periodically; you may not use
the parameters, but they must be there anyway.
void timer_Tick(object sender, EventArgs e) {
    Console.WriteLine("whatever");
    myTextBox.Text=DateTime.Now.ToString("hh:mm:ss");
}


Warning: most timers vanish (i.e. could be garbage collected) as soon as
you stop them, unless of course you keep a reference to it (e.g. as a class member,
rather than a local variable).

Smile | :)



AnswerRe: Invisible countdown? Pin
Manoj Kumar Rai2-Aug-07 20:40
professionalManoj Kumar Rai2-Aug-07 20:40 
GeneralRe: Invisible countdown? Pin
jafingi3-Aug-07 1:36
jafingi3-Aug-07 1:36 
QuestionTo "this." or not to "this.", that is the question... Pin
Poolee2-Aug-07 9:20
Poolee2-Aug-07 9:20 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Luis Alonso Ramos2-Aug-07 9:31
Luis Alonso Ramos2-Aug-07 9:31 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Pete O'Hanlon2-Aug-07 9:39
mvePete O'Hanlon2-Aug-07 9:39 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Judah Gabriel Himango2-Aug-07 10:10
sponsorJudah Gabriel Himango2-Aug-07 10:10 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Martin#2-Aug-07 10:22
Martin#2-Aug-07 10:22 
QuestionRe: To "this." or not to "this.", that is the question... Pin
Poolee3-Aug-07 10:29
Poolee3-Aug-07 10:29 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Martin#6-Aug-07 19:59
Martin#6-Aug-07 19:59 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Colin Angus Mackay2-Aug-07 11:52
Colin Angus Mackay2-Aug-07 11:52 
AnswerRe: To "this." or not to "this.", that is the question... Pin
V.2-Aug-07 20:27
professionalV.2-Aug-07 20:27 
GeneralRe: To "this." or not to "this.", that is the question... Pin
originSH2-Aug-07 21:56
originSH2-Aug-07 21:56 
GeneralRe: To "this." or not to "this.", that is the question... Pin
V.2-Aug-07 22:28
professionalV.2-Aug-07 22:28 
AnswerRe: To "this." or not to "this.", that is the question... [modified] Pin
Malcolm Smart2-Aug-07 21:06
Malcolm Smart2-Aug-07 21:06 
QuestionGrab path of most recent file in a directory Pin
newb2vb2-Aug-07 8:43
newb2vb2-Aug-07 8:43 
AnswerRe: Grab path of most recent file in a directory Pin
led mike2-Aug-07 9:21
led mike2-Aug-07 9:21 
GeneralRe: Grab path of most recent file in a directory Pin
Martin#2-Aug-07 9:34
Martin#2-Aug-07 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.