Numbers display incorrectly in Label.Text field

D

d2bishop

Hi,


I am programmatically setting the .Text property of a number of Labels
on my Windows form at runtime, but I am experiencing some very strange
behaviour when I do this. The code I am using is below:


Label1.Text = "8 " & UCase(strOpen) 'strOpen = "Open"


So the text I would expect to see displayed when I run the application
is: "8 OPEN"
However, I am instead seeing the text "OPEN 8".


I can repeat this behaviour on any Label that has a number as its first

character. I have tried deleting the label and re-creating it, changing

the RightToLeft property, changing the TextAlign property, changing the

Font to Courier New, but in every case the same behaviour persists. I
have also tried inserting extra whitespace characters at the beginning
of the string, but this made no difference.


Below are some relevant properties of the Label I am using:
BorderStyle = FixedSingle
Font = Microsoft Sans Serif, 8.25pt
RightToLeft = No
Text = ""
TextAlign = MiddleCenter
UseMnemonic = True
AllowDrop = False
AutoSize = False


I am running Visual Studio .NET version 7.1.3088 with .NET Framework
1.1 version 1.1.4322 SP1. My computer is running WinXP with all the
latest MS patches.


Any help that someone could offer would be very much appreciated.
Thank you,
-Dan Bishop
 
D

d2bishop

Hi Sean,

Is there some way that I can capture the event where the .Text property
is being filled? The reason I want to do this is to determine if (like
you suggest) there is something else that is overwriting my original
text.
I should note that I experience similar behaviour whenever I place a
non-alpha character at the end of a string. For example, the text "JOG
+" inside a label would appear as "+ JOG"... basically it seems like
any non-alpha character at the start or end of a string gets swapped to
the opposite end.

Any thoughts? Again, I can repeat this behaviour with pretty good
consistency.
-Dan
 
S

Sean Hederman

I just created a VB.NET app, and put in the code in the OP, and it works
100% as expected resulting in "8 OPEN" being displayed in the label.

As for determining when the Label is being filled, use the TextChanged
event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top