473,513 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Numbers display incorrectly in Label.Text field

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

Jul 21 '05 #1
3 1641
Looks fine to me, are you sure it's not being set anywhere else?

<d2******@engmail.uwaterloo.ca> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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

Jul 21 '05 #2
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

Jul 21 '05 #3
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.

<d2******@engmail.uwaterloo.ca> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
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

Jul 21 '05 #4

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

Similar topics

9
3056
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
6
2423
by: dale zhang | last post by:
Hi, I build a web form with a 4-cell table on the top (flawlayout), followed by some labels and textboxes (gridlayout). The web form is displayed well in dell m60 laptop with all resolution...
2
3431
by: Gmansky | last post by:
I have a dataItem that is a text memo field. When I use <%#container.DataItem('memoText')%>, it displays it with no line breaks. Is there a function to convert the line breaks on the memo field?...
3
299
by: d2bishop | last post by:
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...
1
2602
by: John Phelan-Cummings | last post by:
When I add the name of a new individual in a, bound form, it will not display that person’s name in a label control of a second unbound form. I have a scheduling program that I am working on. ...
6
5943
by: Dave | last post by:
Hope someone can help! I have a memo fiels in which there are a few numbers including dates but what I want to do is extract a number which is 6 figures long. Can anyone help me? Thanks Dave
1
4512
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I...
8
2850
by: flyingisfun1217 | last post by:
Hey, Sorry to bother everybody again, but this group seems to have quite a few knowledgeable people perusing it. Here's my most recent problem: For a small project I am doing, I need to...
17
4600
by: Ron | last post by:
I want to write a program that will accept a number in a textbox for example 23578 and then in a label will display the sum of the odd and even number like this... the textbox containsthe number...
0
7267
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,...
0
7175
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...
0
7391
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,...
0
7553
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
5697
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,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.