Solved

Formatting Data within a DataGridView

Posted on 2009-07-02
3
204 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

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

Suggested Solutions

Title # Comments Views Activity
Calling web service and its methods dynamically 2 73
Gridview selected row 9 49
vb.net class 3 21
Access Schema 6 26
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 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