DatagridView assign a variable value for each cell in column
I want to assign a value for example : 000001 for each cell in a datagrid column "COD"
How can i do it ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Bechir BejaouiRank #144 · 15.9K reputationPosted Mar 14, 2009, 3:34 AM EDT
DataGridViewCell myCellTemplate = new DataGridViewTextBoxCell();
//Set the format of the cell
myCellTemplate.Style.Format = string.Format("{0}",0001);
//Set the style of the column using celltemplate attribute
dataGridView1.Columns["COD"].CellTemplate = myCellTemplate;