Monday, June 27, 2011

How to round the decimal values in C#.Net?

string text = "19500.36";
decimal value;
if (decimal.TryParse(text, out value))
{
value = Math.Round(value);
text = value.ToString();
// Do something with the new text value
}
else
{
// Tell the user their input is invalid
}

No comments:

 
Feedback Form