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!