Formatting a column in a Datagridview

  • Thread starter Thread starter cameljs18
  • Start date Start date
C

cameljs18

I have a datagridview but its datasource changes to different
datatable each time i do a search.When a certain table is the
datasource i want all the cells in that column to have three decimals
after the commer eg. #.### how do i do this.
 
Have you checked out the CellStyle.Format property for that column? For
example, this sets the format for a column to short date:

DataGridViewCellStyle dgvCellStyle = new DataGridViewCellStyle();
dgvCellStyle.Format = "d";
theSpeicficDGVColumn.DefaultCellStyle = dgvCellStyle;


RobinS.
GoldMail, Inc.
 
Back
Top