Yeah, Don't close the program.... use a timer control .... you can even use a form to set the "refresh rate" of the timer control. have a box on the form (a textbox) and a button on the form (set rate) and make it in seconds.... then in the code for the set rate button, do a:
timer1.interval = val(text1.text) * 1000
Obviously Rename Timer1 to whatever you name it, and rename text1 to whatever you name the textbox.... that will set the interval (you are multiplying by 1000 because the timer control works in milliseconds...not seconds. Also, Keep in mind that you can not exceed 60000 (1 minute, 60 seconds) with the timer control's duration.
In the timer control... you would do something to refresh the grid... I'm guessing it's going to be a bit of a payload, but if it only happens now and again, say, 15 or 20 seconds... maybe even less, the toll won't be too deadly. Anyway, I'd suggest, in the timer control to REDO your code. An Example would be to erase everything in the grid control, and redo your computations. Then perhaps use the .refresh method, and it should update just fine.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I'm pretty sure the problem is this:
VB has an internal command, called "Rate", I don't remember if it is a function or a class (that requires you to make an instance of it)... but if you rename the textbox from Rate to ... say, tmpRate, or CurrentRate, or something of that nature... it may solve the problem.
I also would only times the interval by 1000, but, it's your code ;)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I think the goal is to be able to CHANGE the value of the timer control, to whatever is in the textbox.... so, if the textbox says "10" they want it to be 10 seconds before the timer event fires. You're 100% correct (which I missed) about Clock and digital... good catch. Rate, Still, is a VB command, and objects should not be named the same as internal commands. Because then you would have to explicitely call it with the entire path (formname.rate.text).
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I'm not seeing the code in your timer.... more to the point, I'm not seeing a timer. The solution, as I see it.... is placing your code
SELECT dbtask.TaskNum, dbtask.txtstatus, dbtask.Operator1, dbtask.Jobtype, dbtask.Reqby, dbtask.Sjob, dbtask.group FROM dbtask WHERE (((dbtask.txtstatus)<>"Finished") AND ((dbtask.group)="C"));
I think it is.... in your timer event. Basically, Redo The Task, Every Time The Timer Event Fires. You might have to clear the grid first... and then re-put everything back on it. So, Every time the timer fires it's event.... the grid gets cleared.... and then re-populated with whatever it is you are trying to put in there.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I would gladly accomplish this task for you, however, I don't have access to SQL. Maybe someone else here does?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Alright, It's not "pretty" but it does what it's supposed to. You'll need to change the connection string to contain the path to the database, instead of "c:\" as I have it now. Let me know the results, and we can move on to the next phase.
http://www.aftermath.net/~coma/status/
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
And like I said when we spoke, Any assistance beyond this that you may need, just let me know. You have my e-mail, and I'd be glad to assist you further... I'm looking forward to helping you with the server app. A little tip, it's in the form resize event ;)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Yeah, Changing The Query shouldn't be a big deal at all. I'm not sure how you want to go about doing it... I would suggest using a bunch of checkbox's and set it up with the checkbox's. In the timer event, search for which checkbox's are checked, and then modify the query string to fit the requested action. If you send me what you've got, I'll help you to modify it into something a little more versatile.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215