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

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

am 01.10.2007 20:58:54 von Fir5tSight

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!

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

am 01.10.2007 22:18:02 von unknown

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!
>
>

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

am 02.10.2007 04:59:12 von Fir5tSight

Adam,

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