You have to use either
int.Parse[
^] or
int.TryParse[
^]
int quan = 0;
quan = int.Parse(textbox.Text);
This puts the integer value into "quan" or throws an exception if there are problems with the conversion.
int quan = 0;
if (int.TryParse(textbox.Text, out quan))
{
...
}
This put the integer value into "quan" and returns true, or returns false if there are problems with the conversion.