I need a timer that will change the text of a combobox which is binded to a database.
My Application which is based on hospital management wherein a doctor has to visit rooms within 6 hours. If 6 hours elapse the combo should show "need......" and if not something "......" and the changes should be also written in the database as there are many rooms. there should also be a button that resets the timer. please help me. Thank you so much

Recommended Answers

All 2 Replies

I need a timer that will change the text of a combobox which is binded to a database.
My Application which is based on hospital management wherein a doctor has to visit rooms within 6 hours. If 6 hours elapse the combo should show "need......" and if not something "......" and the changes should be also written in the database as there are many rooms. there should also be a button that resets the timer. please help me. Thank you so much

There is a timer that you can add to your application, just drag it from the toolbox to anywhere on your application.

private void timer1_Tick(object sender, EventArgs e)
{
//Code to be executed
}

Double click it and add the code to be executed when it ticks. you can set how long between each tick by setting the interval property of the timer, this is an int and holds the time in ms between each tick so for 6 hours you would need 21,600,000 as the value.

//set timer to tick every 10seconds
timer1.Interval = 10000

there are also methods for starting and stopping the timer.

Hope this helps

Well you could always use the DateTime call in C#, and just do a check for when it equals 6 hours from it, here's a link on that

http://msdn.microsoft.com/en-us/library/system.datetime.aspx

But if this in not for real and more a test run or just project, I would probably with what midimatt says, that would work well (plus it seems like he has alittle better programing experience then me)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.