PC Review


Reply
Thread Tools Rate Thread

Cant update StatusStrip items from working thread

 
 
Benny
Guest
Posts: n/a
 
      15th Jun 2006
I have a GUI and a working thread. I have used just regular labels and
used callbacks to update the text on the GUI thread until now. I have
added a status bar with 2 labels i need to be able to change and 1
status bar. None of the actual items on the status bar have a
"InvokeRequired" property and i have tried using the actual status
bar's "InvokeRequired" but i get a nullreference exception. I have
checked all the local variables and none of them are null nothing is
making sense so if someone could show me the light on how to update the
status bar items i would greatly appreciate it! Thanks in advance!

 
Reply With Quote
 
 
 
 
Dan Manges
Guest
Posts: n/a
 
      16th Jun 2006
Hi,

I would try Invoke'ing a method on the form which updates the status
bar. The code would be something like this (not tested):

public MyForm : Form
{
private delegate void NoArgCallback();

private void UpdateStatusBar()
{
//code here
}

private void MethodRunningInThread()
{
NoArgCallback callback = new NoArgCallback(UpdateStatusBar);
this.Invoke(callback);
}
}

You should be able to Invoke on the form like that and then update the
status bar from there.

Hope this helps.

Dan Manges
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
StatusStrip control leaks its collection items carl.clawson@pkinetics.com Microsoft Dot NET Framework 8 11th Jul 2008 06:21 PM
One Thread Updates a Structure Field, But Another Thread Does Not See the Update eBob.com Microsoft VB .NET 4 12th Nov 2007 04:03 AM
StatusStrip resize doesn't work, if StatusStrip is filled up Zytan Microsoft Dot NET 0 26th Apr 2007 09:29 PM
Listen event on the different thread and update data on the UI thread Rajat Microsoft Dot NET Framework Forms 1 10th Dec 2005 09:01 PM
Listen event on different thread and update data on UI thread Rajat Microsoft Dot NET Framework Forms 2 7th Dec 2005 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:02 PM.