Solved

Formatting Data within a DataGridView

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

930 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

8 Experts available now in Live!

Get 1:1 Help Now