473,651 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to update Label in windows form

Hi !

I have a little problem. I have a process that runs when a user click a
button. The process is long to execute (+/- 5 minutes). So, I put a progress
bar and now I want to show the evolution of the process in a label (Step
1/5: Create... Step 2/5 Update....etc.) I don't know why but when I try to
update the text in my label in the middle of my process (Label.text = "Step
1/5: Create...", Label.text = "Step 2/5: Update...", etc.) the label doesn't
react. It comes available only when the process is finished.

What's wrong ?

David
Nov 20 '05 #1
5 2997
Probably the UI thread waits while your other code is executing. But you can
update controls by invoking the Refresh method.
Label1.Text = "..."
Label1.Refresh
--
Greetz,
Jan
_______________ _______________ ____
Read my weblog: http://weblogs.asp.net/jan

"David-L. Nadeau" <d_***@hotmail. com> schreef in bericht
news:uq******** ******@tk2msftn gp13.phx.gbl...
Hi !

I have a little problem. I have a process that runs when a user click a
button. The process is long to execute (+/- 5 minutes). So, I put a progress bar and now I want to show the evolution of the process in a label (Step
1/5: Create... Step 2/5 Update....etc.) I don't know why but when I try to
update the text in my label in the middle of my process (Label.text = "Step 1/5: Create...", Label.text = "Step 2/5: Update...", etc.) the label doesn't react. It comes available only when the process is finished.

What's wrong ?

David

Nov 20 '05 #2
"Jan Tielens" <ja*@no.spam.pl ease.leadit.be> schrieb
Probably the UI thread waits while your other code is executing. But
you can update controls by invoking the Refresh method.
Label1.Text = "..."
Label1.Refresh

Right, but ATTENTION for WinXP users: Due to a very very bad "design
change", calling Refresh is not sufficient anymore! :-((((((((((((((( ((((((

3rd paragraph at
http://msdn.microsoft.com/library/en...sagequeues.asp

This is very bad because we are now FORCED to write multithreaded
applications or use Application.DoE vents although we don't want the user to
operate the application. It seems that the XP developers forgot that a
window is not only for *input* but also for *output*. A window that does not
process input messages does not necessarily mean that it does not display
something.

MSFT, please change this - at least optionally!
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Nov 20 '05 #3
* "David-L. Nadeau" <d_***@hotmail. com> scripsit:
I have a little problem. I have a process that runs when a user click a
button. The process is long to execute (+/- 5 minutes). So, I put a progress
bar and now I want to show the evolution of the process in a label (Step
1/5: Create... Step 2/5 Update....etc.) I don't know why but when I try to
update the text in my label in the middle of my process (Label.text = "Step
1/5: Create...", Label.text = "Step 2/5: Update...", etc.) the label doesn't
react. It comes available only when the process is finished.


Call the label's 'Refresh' method.

Windows Forms + Multithreading
<http://www.devx.com/dotnet/Article/11358>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
On Thu, 4 Dec 2003 20:32:00 +0100, Armin Zingler wrote:

3rd paragraph at
http://msdn.microsoft.com/library/en...sagequeues.asp


I presume you're referring to this paragraph:

<QUOTE>
Microsoft Windows XP: If a top-level window stops responding to messages
for more than several seconds, the system considers the window to be hung.
In this case, the system hides the window and replaces it with a ghost
window that has the same Z order, location, size, and visual attributes.
This allows the user to move it, resize it, or even close the application.
However, these are the only actions available because the application is
actually hung. When in the debugger mode, the system does not generate a
ghost window.
</QUOTE>

Do you know if there is anyway to send a "Keep Alive" signal? Is DoEvents
the only thing that will do this?

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #5
"Chris Dunaway" <dunawayc@_lunc hmeat_sbcglobal .net> schrieb
On Thu, 4 Dec 2003 20:32:00 +0100, Armin Zingler wrote:

3rd paragraph at
http://msdn.microsoft.com/library/en...sagequeues.asp
I presume you're referring to this paragraph:


yes
<QUOTE>
Microsoft Windows XP: If a top-level window stops responding to
messages for more than several seconds, the system considers the
window to be hung. In this case, the system hides the window and
replaces it with a ghost window that has the same Z order, location,
size, and visual attributes. This allows the user to move it, resize
it, or even close the application. However, these are the only
actions available because the application is actually hung. When in
the debugger mode, the system does not generate a ghost window.
</QUOTE>

Do you know if there is anyway to send a "Keep Alive" signal?
I think it is not possible.
Is
DoEvents the only thing that will do this?


Yes, DoEvents or putting the work in a different thread, so that the main UI
thread is not blocked.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1810
by: Stuart Norris | last post by:
Dear Group, I am attempting to write a "splash" and "status" Form using a second thread. I wish to use this Form to display status information to the user when I do CPU intensive work in my GUI during startup. I wish to also use the same Form after startup as well if I do something CPU intensive. I have developed a multi-threaded application however the very first
9
4750
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and DataSet; and all I'm doing is showing one record in text fields, allowing the user to modify the text fields, and then updating the database again when the user clicks the Save button. The fields already show the correct data record since I have...
10
4955
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able to figure out the solution to this problem. First off, the server is Windows Server 2003 - Web Edition (IIS 6) and I'm using .Net Framework v1.1.4322.
2
1499
by: Rene | last post by:
Hi all i need some help. i try to send mail with the following code. Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim mailMsg As New MailMessage mailMsg.From = rene.fehr@netradox.com mailMsg.To = info@netradox.com mailMsg.Subject = "Testmail vom Webforum" mailMsg.Body = "some body text"
0
2199
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
8
5352
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In this code there is a panel panel1, that I populate with a lable in the foreground. Then when I click on "button1" a backgroundworker thread in async mode is started. When the backgoundworker thread completes the thread returns a panel to populate...
3
6276
by: bhanubalaji | last post by:
hi, I am unable to disable the text(label) in javascript..it's working fine with IE,but i am using MOZILLA.. can any one help regarding this.. What's the wrong with my code? I am sending my code here.. Thanks in Advance... Regards
1
2408
by: Markw | last post by:
Hi folks I think I've got a variable problem but not 100% sure. Background: I took the CMS example from chapter 6 in "Build your Own Database Driven Website Using PHP&MySQL" and have attempted to modify it for use in my own database. It almost works for me LOL. contact.php returns my dive buddies first and last name and gives me the option to either Edit or Delete them. Currently the delete option is not active. When I choose to edit...
2
2629
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
0
8352
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8802
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8697
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8579
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2699
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1587
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.