Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2006

Tip: Looking for answers? Try searching our database.

Strange Label behavior

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SLIMSHIM - 23 Nov 2006 01:15 GMT
Can someone explain this one to me ...?
Add one Label and one Button to form .
Set RightToLeft  of Label to True.
try this
Label1.Text="12345.";
on display you will see
.12345
the decimal jumped to the wrong side

if you then do this
Label1.Text = Label1.Text + "00";
on screen you will see
12345.00
it corrected itself
huh?
Thanks in advance
Morten Wennevik - 23 Nov 2006 06:50 GMT
Hi,

I cannot reproduce this.  Could you give us a code sample demonstrating  
the error?  Is the position of the controls important.  What kind of  
Visual Studio (if any) are you using?

> Can someone explain this one to me ...?
> Add one Label and one Button to form .
[quoted text clipped - 12 lines]
> huh?
> Thanks in advance

Signature

Happy Coding!
Morten Wennevik [C# MVP]

SLIMSHIM - 23 Nov 2006 08:04 GMT
I"m using vs 2005
i"m using c#
private void button1_Click(object sender, EventArgs e)
       {
           label1.Text = "12345.";
       }
THIS WILL REPRODUCE IT
the label on screen will show
.12345
this will only happen if RightToLeft is True

thanx a mill for your time!

> Hi,
>
[quoted text clipped - 18 lines]
> > huh?
> > Thanks in advance
Morten Wennevik - 23 Nov 2006 08:35 GMT
Sorry, I still can't reproduce it.  Using a Label, AutoSize true or false,  
LeftToRight Yes or No.  When setting the text during button click it  
always displays "12345." with . at the end.

Does this happen in new projects or just one or a few?

> I"m using vs 2005
> i"m using c#
[quoted text clipped - 35 lines]
>> Happy Coding!
>> Morten Wennevik [C# MVP]

Signature

Happy Coding!
Morten Wennevik [C# MVP]

Jon Skeet [C# MVP] - 23 Nov 2006 08:43 GMT
> I"m using vs 2005
> i"m using c#
[quoted text clipped - 6 lines]
>  .12345
> this will only happen if RightToLeft is True

Could you give a short but *complete* program demonstrating the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for what I mean by
that.

Jon
SLIMSHIM - 23 Nov 2006 15:03 GMT
I started anew project .
I added one label
I changed the properties of the label as such..
autosize = Fals
RightToLeft = Yes
this is my actual code...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
       }

       private void button1_Click(object sender, EventArgs e)
       {
           label1.Text = "12345.";
       }
   }
}

> > I"m using vs 2005
> > i"m using c#
[quoted text clipped - 13 lines]
>
> Jon
SLIMSHIM - 23 Nov 2006 15:07 GMT
> I started anew project .
> I added one label
> I changed the properties of the label as such..
> autosize = Fals
> RightToLeft = Yes
I added a Button
and this is the code for the click event...
> this is my actual code...
>
[quoted text clipped - 39 lines]
> >
> > Jon
Morten Wennevik - 24 Nov 2006 06:53 GMT
Hi,

 'partial class' means this is only part of the code for the class.  You  
need to post the designer code as well (Form1.Designer.cs), and remember  
to show all the designer generated code normally hidden inside a region.

>> I started anew project .
>> I added one label
[quoted text clipped - 47 lines]
>> >
>> > Jon

Signature

Happy Coding!
Morten Wennevik [C# MVP]

Jon Skeet [C# MVP] - 23 Nov 2006 15:35 GMT
> I started anew project .
> I added one label
> I changed the properties of the label as such..
> autosize = Fals
> RightToLeft = Yes
> this is my actual code...

<snip>

What I could do with is the *entire* code - without any need to setup a
project, click anywhere, etc. Something I can cut and paste into a .cs
file and compile. That way we're all *sure* we're talking about the
same code.

Jon
Mattias Sjögren - 23 Nov 2006 17:48 GMT
>I"m using vs 2005
>i"m using c#
[quoted text clipped - 6 lines]
> .12345
>this will only happen if RightToLeft is True

What language version is your operating system? Is it actually a RTL
system?

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

SLIMSHIM - 24 Nov 2006 16:00 GMT
Sorry for taking so long to get back.

I realized that mattias is correct in that what I realy needed was to right
justify  
the text. RighttoLeft is realy only for languages like
hebrew that work backwards.

Never The  Less...
there is nothing special to my code. This was done in a brand new project.
I think the dot has some internal special significance. Any other Character
does not coase this strange behavior..

Thank all of you again for your help
You Guys are the reason humanity still survives!
(willing to give your time and effort to someone you don't know)

> >I"m using vs 2005
> >i"m using c#
[quoted text clipped - 11 lines]
>
> Mattias

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.