label and decimal value

  • Thread starter Thread starter Qiana
  • Start date Start date
Q

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
 
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.
 
what id the values againt propert DecimalValue.
if u are no initializing the private member, then by default it is zero
 
what id the values againt propert DecimalValue.










- 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
 
Back
Top