Exception setting StatusBarPanel Text property

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

I have received the following exception when trying to set the Text property
of a StatusBarPanel. On msdn it says nothing about this method throwing an
exception. Also this only tends to be thrown occasionally. Can anyone clear
this up?

System.InvalidOperationException: Unable to set the panel text.
at System.Windows.Forms.StatusBarPanel.Realize()
at System.Windows.Forms.StatusBarPanel.set_Text(String value)
at ...
 
Most likely you're trying to set it from a thread different from the thread
you created the form on. You're not supposed to do that. Use the BeginInvoke
method to call another method to set the text on the status bar whenever you
could be in code that's not running on the Form's thread.

Chris
 
Back
Top