> int n = int.Parse("24");
int n = int.Parse(TextBox1.Text);
Be sure to wrap that code in a try...catch block in case someone enters
invalid data, like this:
try
{
int n = int.Parse("24");
int n = int.Parse(TextBox1.Text);
}
catch (Exception ex)
{
// Do something to indicate TextBox1 does not contain a valid integer
}
You could also trap for the specific exceptions that Parse can throw, which
are FormatException, ArgumentException and OverflowException.
Eric