set a decimal value

  • Thread starter Thread starter paulotuatail
  • Start date Start date
P

paulotuatail

Hi I have a decimal and I want to set a value to it. This should be simple

decimal LowerEarnings;

//
//
//
//


LowerEarnings = 109.0;

Can't see this simple problem.
 
Hi I have a decimal and I want to set a value to it. This should be simple



decimal LowerEarnings;



//

//

//

//





LowerEarnings = 109.0;



Can't see this simple problem.

ok sorted.
 
Hi I have a decimal and I want to set a value to it. This should be simple

decimal LowerEarnings;
LowerEarnings = 109.0;

Can't see this simple problem.

decimal literals are suffixed with m so:

LowerEarnings = 109.00m;

Arne
 
Hi I have a decimal and I want to set a value to it. This should be simple

decimal LowerEarnings;

//
//
//
//


LowerEarnings = 109.0;

Can't see this simple problem.

Make sure the Error List window is set to display automatically when there
are errors during a build and then READ the error message. Here's what
VS2010 had to say:

Literal of type double cannot be implicitly converted to type 'decimal'; use
an 'M' suffix to create a literal of this type.

Seems pretty straightforward....
 
Back
Top