Solved

Formatting Data within a DataGridView

Posted on 2009-07-02
3
205 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
[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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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