Dim percentage As Integer = (Me.lblAGR.Text / Me.lblBGR.Text * 100 - 100) --> returns 62
How can I return 62% and keep percentage as integer?
Other option would be to store as string and when I update the value replace % with '' and convert back to integer
There must be a location where you want to show the percentage. Depending on what you are using, you can use the format specifiers there (i.e., on a label) to show the percent. An integer is only the number and will not contain anything else then digits.
abel
Note that using the percentage in the format specifier expects a value between 0 an 1 (in other words, it will multiply with 100). So, you can do the following:
davrob60,
Tried that and it's a step in the right direction, the result is: 62.978963464422%. How can I do rounding and not display decimals (63%)
Thanks
that depend of multiple factor, but in my opinion, double.
abel
I second the opinion of davrob60. When you store something for later retrieval, best practice is to keep as much information with it as possible. With the choice you gave, the most details are stored with the double.
You may consider storing the two individual values, which would leave the calculation result out of the database. In terms of sound design, that is often better. You can still have that column with the calculation in it, but then make it a computed column. That is, imo, an even better "best practice" because it leaves all options open for the future.