Wednesday, July 13, 2011

C# Format string with a number to two decimal places

formattedValueFrom =  String.Format("{0:0.00}", decimal.Parse(row["ValueFrom"].ToString().Trim()))

row - A DataRow in a DataTable
ValueFrom - A column in the DataRow

No comments: