set a decimal value

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.
 
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.

ok sorted.
 
A

Arne Vajhoej

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
 
J

Jeff Johnson

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....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top