| | |
Label not updating
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2004
Posts: 489
Reputation:
Solved Threads: 5
Hey guys,
I've got a multithreaded application done in C# but the label on one of my forms won't update! It doesn't do anything
I don't get why.... it doesn't even get set to "Hello"
I've got a multithreaded application done in C# but the label on one of my forms won't update! It doesn't do anything
C# Syntax (Toggle Plain Text)
public IndividualPCSpec(AllKnownDevicesFrm parent) { m_Parent = parent; InitializeComponent(); m_IPAddressLbl.Text = "HELLO"; } public void showInformation(ComputerHardware dto) { m_IPAddressLbl.Text = "HELLO WORLD"; this.Refresh(); this.m_IPAddressLbl.Refresh(); Application.DoEvents(); }
I don't get why.... it doesn't even get set to "Hello"
•
•
Join Date: Dec 2004
Posts: 489
Reputation:
Solved Threads: 5
from another class.
C# Syntax (Toggle Plain Text)
Class X IndividualPCSpec m_individualPC = new IndividualPCSpec (this); ComputerHardware dto = new ComputerHardware(...); .. .. Function X() { showInformation(dto); } }
Normally updating labels in a form is not a thread-safe operation. Check this article out:
http://msdn.microsoft.com/en-us/libr...28(VS.80).aspx
That may give you a good idea of what you have to do to update the label. You need to invoke another method to update the label's text. I'm surprised an exception is not being thrown...
http://msdn.microsoft.com/en-us/libr...28(VS.80).aspx
That may give you a good idea of what you have to do to update the label. You need to invoke another method to update the label's text. I'm surprised an exception is not being thrown...
Alex Cavnar, aka alc6379
![]() |
Similar Threads
- updating jlabel (Java)
- updating a gridview row in web application (VB.NET)
- problem in updating the gridview (ASP.NET)
- Help with GUI. Updating between 2 forms. (C#)
- Problem updating a JLabel?? (Java)
- updating text fields in GUIs (Java)
- Updating Combo Box (Visual Basic 4 / 5 / 6)
- ASP.Net VB Page to update a users profile not updating. (MS SQL)
- Updating Controls (C++)
Other Threads in the C# Forum
- Previous Thread: problem transfering data from one form to another
- Next Thread: Trouble with dataGridViewButtonColumn event
| Thread Tools | Search this Thread |
.net 2007 access activedirectory algorithm array barchart bitmap box broadcast c# check checkbox client combobox connect control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset datetime degrees development disabled displayingopenforms draganddrop drawing encryption enum event eventcloseformc# excel file foreach form format forms ftp function gdi+ httpwebrequest image index index-error input install java label list listbox load mandelbrot math mathematics mouseclick mysql operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox server setup sleep socket sql statistics stream string table text textbox thread time timer totaldays update user usercontrol validation visual visualstudio webbrowser windows winforms wpf xml






