|
-
Oct 30th, 2008, 01:53 PM
#1
Thread Starter
Member
Label.Text not displaying changes
Okay, so this is a weird problem and I simply can't figure out what I'm doing wrong. I have a timer that fires regularly that updates that label.text of a label on my main form. The timer fires correctly, the sub for changing the label runs. I can even go into debug mode and highlight the label.text in my code and it shows the correct string but the text in the form doesn't actually update.
I've checked, double-checked and checked again that the names of the label in the form is correct and that I'm not doing anything obscenely stupid.
I have some multithreading going and a D3D9 loop going as well, could these be interefering?
Any ideas? I'm stumped.
-
Oct 30th, 2008, 02:06 PM
#2
Re: Label.Text not displaying changes
after changing the label.text use:
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Oct 30th, 2008, 02:21 PM
#3
Thread Starter
Member
Re: Label.Text not displaying changes
Tried that, it didn't work =\
-
Oct 30th, 2008, 02:30 PM
#4
Addicted Member
Re: Label.Text not displaying changes
you could also try a form refresh
at the end of the sub that updates the label, try
dim myform as new frmMain
myform.refresh()
Redmo
The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp
Please rate the posts that have helped. Makes us feel all warm and fuzzy
-
Oct 30th, 2008, 02:31 PM
#5
Re: Label.Text not displaying changes
you'll have to post your code.
it sounds like you have several threads running at the same time.
using application.doevents in the right place will probably free up your UI + you'll see your label updates.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Oct 30th, 2008, 07:52 PM
#6
Thread Starter
Member
Re: Label.Text not displaying changes
http://newtons.bit.googlepages.com/Game10-30-08.zip
Here's the source code. If anyone wants to take a look I'd greatly appreciate it. I put a break at the sub that calls that label change event.
It does require the DirectX SDK Aug 08.
-
Oct 31st, 2008, 02:20 PM
#7
Thread Starter
Member
Re: Label.Text not displaying changes
Anybody? Anybody? Bueller?
-
Oct 31st, 2008, 02:26 PM
#8
Re: Label.Text not displaying changes
paste the code you are having trouble with.
-
Oct 31st, 2008, 02:44 PM
#9
Re: Label.Text not displaying changes
But first, have you tried Me.Refresh?
My usual boring signature: Nothing
 
-
Oct 31st, 2008, 03:21 PM
#10
Thread Starter
Member
Re: Label.Text not displaying changes
I've tried Me.Refresh and Application.DoEvents. No luck. The code is just:
Code:
Public Sub UpdateGameDate(ByVal sString As String)
lGameDate.Text = sString
It doesn't actually update the label. However when I go into debug mode and highlight lGameDate.Text it shows a value different than what is displayed on the form (and what it should correctly be incidently). The source code of the project is posted above.
-
Oct 31st, 2008, 03:47 PM
#11
Re: Label.Text not displaying changes
Is that sub called only from the UI thread?
The only remaining possibility that seems even remotely possible...and the more I think about it, the less I actually like it, is that the wrong form is being updated.
Other than that, is there anything ELSE happening on that form? Can you make any other change to determine whether it is just this label, or if nothing about the form is being updated?
My usual boring signature: Nothing
 
-
Oct 31st, 2008, 03:54 PM
#12
Thread Starter
Member
Re: Label.Text not displaying changes
 Originally Posted by Shaggy Hiker
Is that sub called only from the UI thread?
The only remaining possibility that seems even remotely possible...and the more I think about it, the less I actually like it, is that the wrong form is being updated.
Other than that, is there anything ELSE happening on that form? Can you make any other change to determine whether it is just this label, or if nothing about the form is being updated?
I do know that the form is showing updates. I have another label on the form that tells me what the keycode of a button I press is (basically just a debug thing). The sub that updates the gamedate label is being called from a different thread than the UI thread.
The form that all of this is occuring on is the startup form and isn't an instance I create. Could that be part of the problem?
-
Oct 31st, 2008, 05:06 PM
#13
Re: Label.Text not displaying changes
Yeah, the problem lies in those statements. You shouldn't even be able to alter a control from any thread other than the UI thread. You should have received an IllegalCrossThreading exception when you tried to do so. If you didn't, then why not?
If you didn't create an instance of the startup form....that should be fine.
My usual boring signature: Nothing
 
-
Oct 31st, 2008, 05:12 PM
#14
Re: Label.Text not displaying changes
"I have a timer that fires regularly that updates that label.text of a label on my main form. The timer fires correctly, the sub for changing the label runs."
lets see your code for the timer and the sub for changing the label.
-
Oct 31st, 2008, 05:30 PM
#15
Thread Starter
Member
Re: Label.Text not displaying changes
 Originally Posted by Shaggy Hiker
Yeah, the problem lies in those statements. You shouldn't even be able to alter a control from any thread other than the UI thread. You should have received an IllegalCrossThreading exception when you tried to do so. If you didn't, then why not?
If you didn't create an instance of the startup form....that should be fine.
Yea, I didn't get that exception. The weird thing, is that I was getting this same problem before I started multithreaded the program. I can step through the program and watch the timer fire, watch the sub get killed to change the text of the label, highlight the text of the label that shows (correctly) what the text should be. It just doesn't show up in the form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|