|
-
November 6th, 2008, 04:26 AM
#1
Problem using Math.Round()
Hi,
I am having a problem using Math.Round(). My program reads in a decimal from a windows form text box,converts this to a double. Then I am trying to round off the double to the nearest whole number. However this is not working it does not round off the number at all. Here is my code:
double hedgeRatio = Convert.ToDouble(HR.Text);
hedgeRatio = System.Math.Round(hedgeRatio,0);
I am using visual c# 2008 express edition to build my program. Also is it possible to read in a number from the user in a windows form instead of using a Text Box and then converting to a double?
Thanks All, any help or suggestions would be great.
Cheers,
The Big Ham
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|