Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to set up a currency value column in a DataGridView (2005) and I'm following examples from Microsoft on how to do this, but the currency formatting is being ignored.

Here's how the samples (from Microsoft) indicate how it's done:

 

Dim col As New DataGridViewTextBoxColumn()

col.DefaultCellStyle.Format = "C" 'also tried lower case "c", but no luck

... <other properties such as header text etc.> ...

MyGrid.Columns.Add(col)

 

But when values are set on that column, they appear as plain numbers, not currency (i.e., no '$', no comma, etc.).

  • 2 weeks later...
Posted

Try this:

 

Dim col As New DataGridViewTextBoxColumn()

col.DefaultCellStyle.Format = "C"

col.ValueType = GetType(Double)

MyGrid.Columns.Add(col)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...