hello,
in my application i am updating the status bar text property many a times as the different part of code is executed. However, i can see only the last update been performed.
ex:
textBlock1.Text = " Launching your application. please wait ...";
/// some code
textBlock1.Text = " i am ready !";
// some more code here
textBlock1.Text = " done !";
output is :: done !
Is this because the updates are performed very fast?If so how do i handle this situation ? I want the text to stay for some time on screen before the next update.
I tried : thread.sleep(1000); but looks like it is not the right way and it is not working. can anyone help me on this?
thank you
Loading


Wim SturkenboomRank #2,527 · 554 reputationPosted Dec 27, 2014, 9:50 PM EST
textBlock1.Text = "hi";
textBlock1.Refresh();
System.Threading.Thread.Sleep(1000);
textBlock1.Text = "hallo";
textBlock1.Refresh();
System.Threading.Thread.Sleep(1000);
textBlock1.Text = "done";
textBlock1.Refresh();
System.Threading.Thread.Sleep(5000);
Don't slowdown user experience because YOU want to show something; if the code is fast, it is fast, nothing you WANT to do about that.
Sanju SinghRank #6,374 · 268 reputationPosted Dec 27, 2014, 9:58 PM EST
Michal HabalcikRank #902 · 2.3K reputationPosted Dec 28, 2014, 1:08 AM EST
Here you can find more info about it: MSDN BackgroundWorker
VulpesRank #55 · 29.2K reputationPosted Dec 28, 2014, 1:57 AM EST
Sanju SinghRank #6,374 · 268 reputationPosted Dec 28, 2014, 6:48 PM EST
Sanju SinghRank #6,374 · 268 reputationPosted Dec 28, 2014, 6:53 PM EST
Wim SturkenboomRank #2,527 · 554 reputationPosted Dec 28, 2014, 7:15 PM EST
well, this Refresh() method is not available ! I am using visual studio 2010
[/quote]
So what is the type of textBlock1? Is it a textbox, is it a label, is it a custom control, is it a statusbar?
According to MSDN, the refresh() method is available for the statusbar from (at least) dotnet framework 1.1 onwards; ref http://msdn.microsoft.com/en-us/library/system.windows.forms.statusbar_methods%28v=vs.71%29.aspx, from there you can check the newer versions
Sanju SinghRank #6,374 · 268 reputationPosted Dec 28, 2014, 8:40 PM EST
Wim SturkenboomRank #2,527 · 554 reputationPosted Dec 28, 2014, 9:58 PM EST
Ref:http://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.textblock.aspx#methods