Reputation: 201
I made a label which changes according to the value of a variable called "caster1hp". This variable is initialy equal to 10, but everything a button is clicked it is equal to itself - 10. Everything works good, I'v researched some question and I found out that I can convert the int variable to string so I can use it in the label doing this: hpcaster1.Text = caster1hp.ToString(); Where the: hpcaster1 is the label; caster1hp is the variable mentioned above.
I'v researched even more questions but I can't find an answer to this question. How to add the "%" character after the number from the "caster1hp" variable? Right now the label named "hpcaster1" displays the number 100 and decreases if I press the button that reduces the "caster1hp" variable, but I want to add the character "%" too, maybe I am blind but I can't find an answer to this in the other questions from other users.
Thanks alot !
Upvotes: 0
Views: 101
Reputation: 36
hpcaster1.Text = caster1hp.ToString()+"%";
This will add the % mark after caster1hp value
https://msdn.microsoft.com/en-us/library/ms228504.aspx
Upvotes: 2
Reputation: 23
You have to add "+" sign and then add your second string:
hpcaster1.Text = caster1hp.ToString() + "%";
Here you are.
Upvotes: 1