Panos_gr

Hello all,

In my application i would like to inform the user about the progress of it.. I have inserted a label at the bottom of my main screen and although i am invoking everything from my main GUI thread i also use event handlers and anonymous delegates..

e.g. on my GUI thread i have

UpdateStatus("Connected to : " + mNetworkAdaptersIdea.AssociatedAccessPoint.ToString());

which is the following :

public void UpdateStatus(string strStatus)

{

EventHandler myDelegate = delegate

{

lblStatusValue.Text = strStatus;

};

try

{

BeginInvoke(myDelegate);

}

catch (ObjectDisposedException e)

{

//if the application closes rapidly

}

}

but i cannot see that on the screen at all! even if i place a Thread.sleep(1000) after the UpdateStatus call i still cannot see it...

any suggestions



Re: .NET Compact Framework update messages on screen..

Alex Yakhnin MSFT

Try to add Application.DoEvents() after you assign the value to the label.






Re: .NET Compact Framework update messages on screen..

Panos_gr

thx it helpedSmile

not with every message but with a lot of them!

what i am thinking is if the DoEvents() "pushes" delegates to be done or label.text="sth" executions .... logic says the former one but practice shows that the later ones are also shown...