Solved

Set gridview column to currency

Posted on 2012-03-31
1
1,483 Views
Last Modified: 2012-03-31
I am using vb.net, datagridview.

I need a way or code to set a column on the datagridview to be set to currency.

I tried setting the column format using the designer on the gridview settings and set it to currency format. But even then when i enter any numbers into that, whether those numbers have decimal or not the numbers just get added as numbers, they don't have the currency symbol next to it and even don't get decimal points when i just enter a whole number

Hope i was clear with my question

thanks in advance.
0
Comment
Question by:baabaa_nl
1 Comment
 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
ID: 37791225
If your datagridview is not databound, then you will have to set the column type before this happens (else the datagridview assumes thevalue is a string!) Add this inyour form load event
DataGridView1.Columns(0).ValueType = GetType(Decimal)

Open in new window

to apply to your DataGridView1 in the first column
Or in the designer
desg
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question