how do i round off decimal values ?
Example :
decimal Value = ‘ 19500.98’
i need to display this value to textbox with rounded off like ‘ 19501 ‘
if decimal value = ‘ 19500.43’
then
value = ‘ 19500 ‘
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Look at
Math.Round(decimal)or the overload which takes aMidpointRoundingargument.Of course, you’ll need to parse and format the value to get it from/to text. If this is input entered by the user, you should probably use
decimal.TryParse, using the return value to determine whether or not the input was valid.