Click here to Skip to main content
15,885,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey I have following code

C#
return string.Format("{0} (${1} EE ${2} DEP to Any Plan)",
                       _excelResource.GetValue("EMPLOYERCOST", languageId),
                      _excelService.CheckNull(bundle, m => m.EmployerContribution.ContributionAmount.Amount.Employee),
                      _excelService.CheckNull(bundle, m => m.EmployerContribution.ContributionAmount.Amount.Dependent));



from gui when amount insert is 100
it should display 100 and when amount insert 150.75 it should display 150.75.

with above code i am getting result 100.00 and 150.75

if i apply math.round then also no effect and not even convert.to decimal

.....what code should be there so that in different scenario i get the same result as inserted in gui.

amount are for calculation purpose.

help will be highly appreciable
Posted
Updated 2-Jun-14 21:41pm
v3
Comments
syed shanu 3-Jun-14 2:18am    
Use String insted of using int or Double.

1 solution

Try This..

C#
decimal result = _excelService.CheckNull(bundle, m => m.EmployerContribution.ContributionAmount.Amount.Employee);
string displayResult = result.ToString("0.##");



if it will work for you then accept it.
 
Share this answer
 
Comments
shivani 2013 3-Jun-14 3:29am    
its not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900