How to set that as a condition in a If ?

I’m receiving a String from a form, It needs to be converted into a int so It can only be number.
I want to detect that error:

FormatException: Input string was not in the correct format
System.Int32.Parse (System.String s)

and if I receive this error do something.

How can I detect that the int.parse(string) doesn’t return a Int ?

Do this

try
{
    int realNum = Integer.Parse("100");
}
catch(FormatException e)
{
    Debug.Log("Do stuff here");
}

Another other way is to use the TryParse method and avoid try/catches altogether:

string input = "this is not a number!";

int number;
if (Int32.TryParse(input, out number))
{
	//valid number inputted!
}
else
{
	//invalid text provided, ask user for valid number
}