How can I convert String to Int?
Try this: int x = Int32.Parse(TextBoxD1.Text); or better yet: int x = 0; Int32.TryParse(TextBoxD1.Text, out x); Also, since Int32.TryParse returns a bool you can use its return value to make decisions about the results of the parsing attempt: int x = 0; if (Int32.TryParse(TextBoxD1.Text, out x)) { // you know that the parsing attempt // … Read more