J
Just_a_fan
Situation:
Timer1 on main form needs to be stopped during a thread action.
Programming in second thread:
timer1.enabled = false
Action:
1. No error
2. Timer is not stopped.
Well, thanks!
There is no .InvokeRequired available for a timer control
There is no error message
There is no action
What could be worse than nothing happening and no message saying it did
not happen? Oh, I know, a message saying "The action was not
performed." with no information about what action was not performed.
Yes, I fixed it by creating a global variable and setting it and having
the timer tick code look at the global variable to see if it should
proceed or exit. Very stupid and wasteful but, at least, it works.
There seems to be an idea that threads should not change global
variables which are to be viewed by code outside the thread but I see no
other way to proceed. Spawning a form would require the same global
because I don't want to use ShowDialog on it so the main thread UI will
continue to work.
Mike
Timer1 on main form needs to be stopped during a thread action.
Programming in second thread:
timer1.enabled = false
Action:
1. No error
2. Timer is not stopped.
Well, thanks!
There is no .InvokeRequired available for a timer control
There is no error message
There is no action
What could be worse than nothing happening and no message saying it did
not happen? Oh, I know, a message saying "The action was not
performed." with no information about what action was not performed.
Yes, I fixed it by creating a global variable and setting it and having
the timer tick code look at the global variable to see if it should
proceed or exit. Very stupid and wasteful but, at least, it works.
There seems to be an idea that threads should not change global
variables which are to be viewed by code outside the thread but I see no
other way to proceed. Spawning a form would require the same global
because I don't want to use ShowDialog on it so the main thread UI will
continue to work.
Mike