[2.0] custom format column datagridview
in a datagrid view, if I add a custom row (not binding to anything at all):
Code:
this.theDataGridView.Columns.Add("Value", "Value");
this.theDataGridView.Columns.Add("Name", "Name");
string[] rows = new string[2];
rows[0] = "5.236";
rows[1] = "blah";
this.theDataGridView.Rows.Add(rows);
how can I set the format of the value column?
I know that this works:
this.theDataGridView.Columns["Value"].DefaultCellStyle.Format = "#.##";
but only when you are binding to a datasource, such as SQL.
If I apply this at any point in the code, it still does not format the column, to give me the format as follows:
x.xx -> 5.23
any ideas?
Re: [2.0] custom format column datagridview
yes I believe I solved it, pretty obvious: incorrect data format!