-
Aug 21st, 2014, 09:31 AM
#1
Thread Starter
New Member
Datagridview currency rounding
I have a column in a Datagridview that I set as currency because if someone enters 2000 I want it to display as $2,000, etc. The problem is, if someone enters $8.99 it rounds it up to $9 automatically. (.net does that automatically for currency).
Is there any way to turn off rounding?
I want to keep the "$" and "," and the only other option I see is to set it as a text column but then if someone clicks on the column to sort it, it will not sort properly because it will be sorting as text and $10,000 would come before $4,000 in that case.
Thanks,
Steve
-
Aug 21st, 2014, 09:33 AM
#2
Thread Starter
New Member
Re: Datagridview currency rounding
I forgot to mention... it's an unbound datagridview...
-
Aug 22nd, 2014, 11:32 PM
#3
Re: Datagridview currency rounding
You may perform custom sorting(numbers/currency) in the DataGridView's Sort.Compare event.
DataGridView.SortCompare Event
How-to-sort-a-DataGridView-Column-numerically
KGC
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|