Public Class Form1
    
    Private Sub btnCompute_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompute.Click
        Dim percent As Double

        percent = (txtGrams.Text * 9) / txtCalories.Text * 100

        Dim fmtstr As String = "{0, -15:p3}"
        lstResult.Items.Clear()
        lstResult.Items.Add(String.Format(fmtstr, txtFood.Text & " containts " & percent & _
" calories from fat."))
    End Sub
End Class

------------------------------------------------------------------------
Above is the code i have created.
I am having issue with the variant "Percent" to display 37.50% instead of 37.5. Hope someone can help me.

Thank you in advance!

Try adding the % sign before the word calories in your output string.

Thank you
could you give me a hint on how to have the number be 37.50 instead od 37.5

thanks

I believe the Format function will help.

i know about the Formatpercent.
My issue is that i am unable to figure out where it is suppose to go.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.