Solved

Set gridview column to currency

Posted on 2012-03-31
1
1,425 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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now