Formatting a column in a Datagridview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cameljs18@yahoo.com

    Formatting a column in a Datagridview

    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.
  • RobinS

    #2
    Re: Formatting a column in a Datagridview

    Have you checked out the CellStyle.Forma t property for that column? For
    example, this sets the format for a column to short date:

    DataGridViewCel lStyle dgvCellStyle = new DataGridViewCel lStyle();
    dgvCellStyle.Fo rmat = "d";
    theSpeicficDGVC olumn.DefaultCe llStyle = dgvCellStyle;


    RobinS.
    GoldMail, Inc.
    -----------------------------
    <cameljs18@yaho o.comwrote in message
    news:928f5485-40cc-4b11-bcde-bfe57755a720@l1 6g2000hsh.googl egroups.com...
    >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.

    Comment

    Working...