473,396 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Form controls don't update in sync

I have a form with a progress bar and a label. The form launches a class
that raises an event to indicate the progress. The event arguments contains
integers to update the progress bar and a string to update the label. The
event handler modifies the two controls with values from the arguments.
But... the progress bar updates fine but the label does not. The label
control will update but not the event has been handled several times. I put
a message box inside the event handler to assure that both controls were
being processed, they both do update as I would expect.

I tried using a TextBox instead of a Label with no difference. I tried an
'invalidate' on the form, no difference. I compiled with VS 2003 and VS
2005, same behavior.

What am I missing here?
Jan 18 '06 #1
2 2404
Is your main processing happening in the Main UI thread or a seperate thread?
If it is in the main UI thread then maybe the label is not getting chance to
update because the thread is busy processing. Try calling Label::Refresh()
to force an update of Application.DoEvents() to allow the paint related
messages to be processed.

Also a code sample showing the problem would be useful in possible.

Mark.

"Dick Swager" wrote:
I have a form with a progress bar and a label. The form launches a class
that raises an event to indicate the progress. The event arguments contains
integers to update the progress bar and a string to update the label. The
event handler modifies the two controls with values from the arguments.
But... the progress bar updates fine but the label does not. The label
control will update but not the event has been handled several times. I put
a message box inside the event handler to assure that both controls were
being processed, they both do update as I would expect.

I tried using a TextBox instead of a Label with no difference. I tried an
'invalidate' on the form, no difference. I compiled with VS 2003 and VS
2005, same behavior.

What am I missing here?

Jan 18 '06 #2
Thanks Mark, the Refresh() works.
"Mark R. Dawson" <Ma*********@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
Is your main processing happening in the Main UI thread or a seperate
thread?
If it is in the main UI thread then maybe the label is not getting chance
to
update because the thread is busy processing. Try calling
Label::Refresh()
to force an update of Application.DoEvents() to allow the paint related
messages to be processed.

Also a code sample showing the problem would be useful in possible.

Mark.

"Dick Swager" wrote:
I have a form with a progress bar and a label. The form launches a class
that raises an event to indicate the progress. The event arguments
contains
integers to update the progress bar and a string to update the label.
The
event handler modifies the two controls with values from the arguments.
But... the progress bar updates fine but the label does not. The label
control will update but not the event has been handled several times. I
put
a message box inside the event handler to assure that both controls were
being processed, they both do update as I would expect.

I tried using a TextBox instead of a Label with no difference. I tried
an
'invalidate' on the form, no difference. I compiled with VS 2003 and VS
2005, same behavior.

What am I missing here?

Jan 18 '06 #3

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

Similar topics

14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
8
by: Vivek | last post by:
Hi, I wish to update the LIST<T> created in PARENT FORM from the CHILD FORM. Currently I have declared the LIST<Role> as public in my parent form. What can I do to update the <LIST>? Thanks
6
by: Peter Zolja | last post by:
Hi, I'm building a webcontrol that contains a dynamic list of other controls. My problem is that when I add or remove an item the synchronization between the ViewState and the Controls...
4
by: Simon Tamman {Uchiha Jax} | last post by:
Scenario: Two System.Windows.Forms: Form1 and Form2. Form1 is displayed, Form2 is hidden. At this juncture, is it possible to take the graphics from Form2 and output that to Form1's display...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
3
by: rob | last post by:
I've got a couple stretches of code where I use a lot of CPU on various operations. Since this is happening in a loop at unrestriicted speed, some of the form controls do not update. (Actually...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.