Solved

Set gridview column to currency

Posted on 2012-03-31
1
1,477 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get Client IP on RDS - VB.NET 15 70
cannot connect to sqlserver 8 35
VB.NET 2008 - SQL Timeout 9 34
vb.net cycle through results of a sql query and capture variables 3 18
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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