Solved

Set gridview column to currency

Posted on 2012-03-31
1
1,517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

634 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