node.Cells[2].Value = "$ " + numVal * usa;
if (toolStripComboBox1.SelectedIndex >= 0) { foreach (TreeGridNode node in myTGV.Rows) { if (node.Cells[2].Value != null) { myTGV.Columns["Cost"].DefaultCellStyle.Format = String.Format("C", System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); //string value = node.ToString(); //node.Cells[2].InheritedStyle.Format = "#,###.##"; int numVal = Convert.ToInt32(node.Cells[2].Value); float usa = (float)numCurrency.Value; //string value = numVal * usa; node.Cells[2].Value = numVal * usa; } } }
TreeGridNode
DefaultCellStyle.Format
"C"
String.Format
DataGridViewCell
DataGridViewCellStyle.Format = "C";
DataGridViewCellStyle.FormatProvider = IFormatProvider; //default is CurrentUICulture
System.Globalization.CultureInfo
CultureInfo
myTGV.Columns["Cost"].DefaultCellStyle.Format = "C";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)