ToolStripProgressBar and InvokeRequired

  • Thread starter Thread starter TJO
  • Start date Start date
T

TJO

Why is there no InvokeRequired property on the ToolStripProgressBar
that would enable cross thread manipulation?
 
Why is there no InvokeRequired property on the ToolStripProgressBar
that would enable cross thread manipulation?

Because InvokeRequired (as well as Invoke and BeginInvoke) are part of the
Control class and ToolStripProgressBar doesn't derive from the Control
class (it derives from the Component class instead).

You can however call ToolStripProgressBar's functions from another thread
than the UI thread by using the InvokeRequired property and the Invoke and
BeginInvoke functions of any other UI control (your form for example).
Since all the UI controls are created in the UI thread (unless you've done
otherwise but that would not be wise), it doesn't matter on which control
you are calling InvokeRequired, Invoke or BeginInvoke, the result will be
the same.
 
Back
Top