Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Casting decimal to currency

$
0
0

Hi there everyone,

In calculating the "_totalcost" in the last line I'm having problem with casting decimal to currency and getting this error:

"input string was not in correct format."

Any Idea how to cast these two 

  decimal? _totalweight = 0;
  Money _unitprice ;
  Money _totalcost ;

   _unitprice = _product.sfd_unitprice;
   _unitprice =new Money(1);


   _totalcost = _opportunityproduct.sfd_totalcost;
                if (_totalcost==null)
                {
                    _totalcost = new Money(0);
                }

 _totalcost = new Money(decimal.Parse(_totalweight.ToString()) * decimal.Parse(_unitprice.ToString()));


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>