Solved

Formatting Data within a DataGridView

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now