Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Datagrid Currency Column??

Datagrid Currency Column??

Scheduled Pinned Locked Moved C#
cssquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DougW48
    wrote on last edited by
    #1

    Is there a style or built in way of having a data grid column show a double or decimal as a currency, or am I going to have to create a custom column? Thanks!!

    H 1 Reply Last reply
    0
    • D DougW48

      Is there a style or built in way of having a data grid column show a double or decimal as a currency, or am I going to have to create a custom column? Thanks!!

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Explicitly define a DataGridTableStyle in the DataGrid.TableStyles for your table (or collection) and add a DataGridTextBoxColumn for that currency column. Set the Format property to "c". The values set in the Format property are the format specifiers for the Type of the DataColumn (or property) you bind your column style to. So, if you look at the documentation for the NumberFormatInfo, you'll see that "c" or "C" formats the number using the culture-specific currency format.

      Microsoft MVP, Visual C# My Articles

      D 1 Reply Last reply
      0
      • H Heath Stewart

        Explicitly define a DataGridTableStyle in the DataGrid.TableStyles for your table (or collection) and add a DataGridTextBoxColumn for that currency column. Set the Format property to "c". The values set in the Format property are the format specifiers for the Type of the DataColumn (or property) you bind your column style to. So, if you look at the documentation for the NumberFormatInfo, you'll see that "c" or "C" formats the number using the culture-specific currency format.

        Microsoft MVP, Visual C# My Articles

        D Offline
        D Offline
        DougW48
        wrote on last edited by
        #3

        That's pretty slick. Thanks Heath

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups