Home All Groups Group Topic Archive Search About

label and decimal value

Author
7 Mar 2007 9:03 PM
Qiana
Is there any know problem with sending a decimal value to a label
control in .net 2.0? I am assigning the label value to a label control
like this:

Dim New MyObject as Object

lblDecimal.Text = MyObject.DecimalValue

The label is showing a 0 when it should be returning a decimal value.

Any help is appreciated.

Qiana

Author
8 Mar 2007 9:19 AM
ClayB
In your MyObject class code, is DecimalValue explicitly set to some
value (other than zero) in the default constructor (ie, the
constructor that you supply with no arguments), or has some non-zero
default value set some other way? If not, then the Framework defaults
this value to zero, and that would be why you are seeing the 0 in the
label.

If you want to see decimal places, then try

                        lblDecimal.Text =
MyObject.DecimalValue.ToString("#.000");

==============
Clay Burch
Syncfusion, Inc.
Author
8 Mar 2007 9:21 AM
Mubashir Khan
what id the values againt propert DecimalValue.
if u are no initializing the private member, then by default it is zero
Show quote
"Qiana" <QTi***@gmail.com> wrote in message
news:1173301387.296427.15990@p10g2000cwp.googlegroups.com...
> Is there any know problem with sending a decimal value to a label
> control in .net 2.0? I am assigning the label value to a label control
> like this:
>
> Dim New MyObject as Object
>
> lblDecimal.Text = MyObject.DecimalValue
>
> The label is showing a 0 when it should be returning a decimal value.
>
> Any help is appreciated.
>
> Qiana
>
Author
8 Mar 2007 2:07 PM
Qiana
Show quote
On Mar 8, 4:21 am, "Mubashir Khan" <m***@yahoo.com> wrote:
> what id the values againt propert DecimalValue.
> if u are no initializing the private member, then by default it is zero"Qiana" <QTi***@gmail.com> wrote in message
>
> news:1173301387.296427.15990@p10g2000cwp.googlegroups.com...
>
>
>
> > Is there any know problem with sending a decimal value to a label
> > control in .net 2.0? I am assigning the label value to a label control
> > like this:
>
> > Dim New MyObject as Object
>
> > lblDecimal.Text = MyObject.DecimalValue
>
> > The label is showing a 0 when it should be returning a decimal value.
>
> > Any help is appreciated.
>
> > Qiana- Hide quoted text -
>
> - Show quoted text -

Thank you both for getting back to me. Unfortunately, someone had
commented out the line in the class that set the property. I knew
something weird was going on. Thanks again for your help. I really
appreciate it.

Qiana

AddThis Social Bookmark Button