Solved

Formatting Data within a DataGridView

Posted on 2009-07-02
3
203 Views
Last Modified: 2012-05-07
Hi, I'm using VB 2005, WinForms. I have a DataGridView that contains a column for a score value. In my DataBase table the scores are formatted as percenatges like such (98%, 73%, 100%, etc). However, when they load into my DataGridView, I'm seeing them formatted as decimals (.98, .73 and as 1). I would like to convert the data type of the DataGridView cell to "percentage" (%).

How would I do that assuming my line of code is?

dgvStudentInfo.Columns("Grade%")

Thanks,
Fulano
0
Comment
Question by:Mr_Fulano
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
wht1986 earned 500 total points
ID: 24769350
i believe the formatting option for percentage with no decimal places is "p0"

Me.dgvStudentInfo.Columns("Grade").DefaultCellStyle.Format = "p0"
0
 

Author Comment

by:Mr_Fulano
ID: 24769707
Hi wht1986, yes indeed. You are correct! Thank you for the help.
0
 

Author Closing Comment

by:Mr_Fulano
ID: 31599437
Great work - thank!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Extracting last characters in a substring 5 27
Creating a route in asp.net webforms 2 26
VB.NET (2008) - Refactoring Question 2 21
Write to a printer using vb.net 9 27
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

778 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