Either use Int32.Parse or Int32.TryParse or you could use System.Convert.ToInt32
int intValue = 0;
if(!Int32.TryParse(yourTextBox.Text, out intValue))
{
// handle the situation when the value in the text box couldn't be converted to int
}
The difference between Parse and TryParse is pretty obvious. The latter gracefully fails while the other will throw an exception if it can't parse the string into an integer. But the differences between Int32.Parse and System.Convert.ToInt32 are more subtle and generally have to do with culture-specific parsing issues. Basically how negative numbers and fractional and thousands separators are interpreted.