Code:
try
{
int i = Convert.ToInt32(textbox.text);
...
}
catch(Exception EXC)
{
MessageBox.Show("Error:\n" + EXC.Message");
}