472,351 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

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 1747
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stacey | last post by:
Hi, I'm hoping for a bit of advise-- I have a (relatively, from the point-of-view of this dilettante) complex script that attempts to preload...
12
by: junky_fellow | last post by:
Which is better using a switch statement or the if-then equivalent of switch ?
3
by: ken | last post by:
any function is equal to "Switch" in Java with VB thank heaps
3
by: Stimp | last post by:
I have two dropdowns that take a few seconds to populate (they are populated from a remote database, but the connection to the database is not the...
2
by: dana lees | last post by:
Hi, I am developing a c# asp.net application. I have a button which when i click on i open a pdf file. Since the pdf file is very very large i...
0
by: Sudz28 | last post by:
Greetings! I am attempting to write a program that will allow a user to manipulate data read from a file, and am obviously in no way near finished. ...
2
by: brianflannery | last post by:
Greetings! My situation is this. I currently have a database of which in a form displays jpeg pictures (one at a time) which are linked to the db...
2
by: =?Utf-8?B?Z2VvZmZh?= | last post by:
I cannot figure this out and would appreciate any help..... I have a datagrid view that displays the results from a Stored Procedure. it can take...
7
by: saurabhsingh | last post by:
Can anyone plz suggest any Idea that How to implement "loading message" in a site with master pages. I am having Default page which is master page...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.