Joel B
Joel B

Reputation: 13130

Setting a ToolStripLabel in a thread-safe manner

I have a ToolStripLabel that needs to have its Text property updated from an event handler on a separate thread. Normally with a regular Label I've been using the InvokeRequired property and invoking a delegate to do the work if InvokeRequired returns true. The trouble is that ToolStripLabel doesn't have this property. What is the cleanest way to get this text updated in a thread-safe manner?

Upvotes: 2

Views: 1110

Answers (1)

Felice Pollano
Felice Pollano

Reputation: 33252

Use the InvokeRequired on the ToolStrip control instead of the ToolStripLabel.

Upvotes: 5

Related Questions