469,609 Members | 1,829 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Switch from "loading..." message to file name

There's a problem with what is displayed on a tab in my UI. At first,
it's a message, "loading...". Then it should be replaced with the
actual file name on the tab.

Now the issue is that it takes a long time before the message
"loading..." is replaced by file name. In my debugger, the switch
between "loading..." and file name happens AFTER the last line of code
below:

void LoadReportFilesWorker_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
{
this.tabControl.SuspendLayout();

foreach(TabPage lPage in mDynamicPages)
{
this.tabControl.TabPages.Add(lPage);
}
this.tabControl.TabPages.Remove(mLoadingPage);

this.tabControl.ResumeLayout(true);
}

When I hit F10 at "}", "loading..." is replaced by the file name.
Anyone can tell me why it takes long time to get the file name
displayed? Thanks!

Oct 1 '07 #1
2 1640
It might be that the UI thread must wait until it can actually refresh the
display.

Try to use:
Application.DoEvents();
right after you change the "loading..." caption to the actual filename.
HTH,
--
_____________
Adam Bieganski
http://godevelop.blogspot.com
"Curious" wrote:
There's a problem with what is displayed on a tab in my UI. At first,
it's a message, "loading...". Then it should be replaced with the
actual file name on the tab.

Now the issue is that it takes a long time before the message
"loading..." is replaced by file name. In my debugger, the switch
between "loading..." and file name happens AFTER the last line of code
below:

void LoadReportFilesWorker_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
{
this.tabControl.SuspendLayout();

foreach(TabPage lPage in mDynamicPages)
{
this.tabControl.TabPages.Add(lPage);
}
this.tabControl.TabPages.Remove(mLoadingPage);

this.tabControl.ResumeLayout(true);
}

When I hit F10 at "}", "loading..." is replaced by the file name.
Anyone can tell me why it takes long time to get the file name
displayed? Thanks!

Oct 1 '07 #2
Adam,

Thanks for respond! What does the UI thread wait for?

Oct 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Stacey | last post: by
12 posts views Thread by junky_fellow | last post: by
3 posts views Thread by Stimp | last post: by
2 posts views Thread by dana lees | last post: by
reply views Thread by Sudz28 | last post: by
2 posts views Thread by =?Utf-8?B?Z2VvZmZh?= | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.