We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,624 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

convert an integer value to percentage

how i can convert an integer value to percentage value (%) , using vb.net

3
Contributors
7
Replies
2 Days
Discussion Span
9 Months Ago
Last Updated
9
Views
Question
Answered
HibaPro
Junior Poster
126 posts since Jun 2012
Reputation Points: -3
Solved Threads: 2
Skill Endorsements: 0

i think you have to convert your int value first in decimal value and after that make calculations and then just convert your decimal value to string and concatinate it with "%" string.

Regards

M.Waqas Aslam
Master Poster
743 posts since Aug 2011
Reputation Points: 50
Solved Threads: 120
Skill Endorsements: 2

can you provide me a vb code ?

HibaPro
Junior Poster
126 posts since Jun 2012
Reputation Points: -3
Solved Threads: 2
Skill Endorsements: 0

A percentage of what? Are you having problems with the calculation or with the conversion (formatting) for display?

Reverend Jim
Carpe per diem
Moderator
3,590 posts since Aug 2010
Reputation Points: 561
Solved Threads: 445
Skill Endorsements: 32

i have a problem of both , can u help me?

HibaPro
Junior Poster
126 posts since Jun 2012
Reputation Points: -3
Solved Threads: 2
Skill Endorsements: 0

Let's say you have a group of 147 people and 36 are female. That means that the fraction of people who are female is 36/147. The percentage of females is one hundred times that. So

Dim people As Integer = 147
Dim female As Integer = 36

Dim percent As Double = 100.0 * female / people

'format as floating point with two decimal places

MsgBox(percent.ToString("F2") & "%")
Reverend Jim
Carpe per diem
Moderator
3,590 posts since Aug 2010
Reputation Points: 561
Solved Threads: 445
Skill Endorsements: 32

very useful thanks.

HibaPro
Junior Poster
126 posts since Jun 2012
Reputation Points: -3
Solved Threads: 2
Skill Endorsements: 0

if your prob is solved please mark this thread solved , regards

M.Waqas Aslam
Master Poster
743 posts since Aug 2011
Reputation Points: 50
Solved Threads: 120
Skill Endorsements: 2
Question Answered as of 9 Months Ago by Reverend Jim and M.Waqas Aslam

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0943 seconds using 2.71MB