You have 2 main ways to approach this, as far as I can see it:
1) Make the variable type uint
instead of int
. uint
is an unsigned integer number, ranging from 0 to 18446744073709551615 (You can read more about variable types in Wikipedia. I do recommend you to, since it is an important topic).
Moreover, you will get an exception when trying to make a uint
less than 0, so you will be able to know where exactly something went wrong.
2) You can simply use the Math.Abs()
method, which returns the absolute value of a number (e.g entering -9 will give back 9, and so would entering 9).
Just as a side note, you can make that line a bit simpler by changing it to:
phrase.Points -= (int)Settings.ABtn;