Is there a way to format a percentage of a value without doing any math?

In VS 2005, is there a way to format a value by percentage, like: Value = 50% of Value without doing any math (5 = 50% of 10)?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
Not sure exactly what you are asking here...

Like this?

        Dim value As Integer = 10
        Dim str As String = (0.5 * value).ToString("0")

You have to do the "math" by multiplying by .5 to get 50%.  There isn't anything you could place in the ToString() portion that would do this for you if that is what you are asking...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dim str As String =  (5.0 / 10.0).ToString("00%")
you will get your 50%
It will not work without math, unless you write a small function

    Private Function Percent(ByVal v As Double, ByVal v100 As Double) As String
        Return (v / v100).ToString("00%")
    End Function

Dim str As String =Percent(5.0,10.0) ' this is as math-free as it gets

grouchyfdAuthor Commented:
Thank you both. This is what I was looking for. One time I can just incorporate the code, the other I can make a public/private function  so an app. can do the same thing several times.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.