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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top