The TryParse
method returns a Boolean
value indicating if the parse was successful or not. If so, it sets the output parameter to the parsed value.
So what you'll want is something like:
int parsedMonth; // This will get set if myColMonth is a valid integer
if (int.TryParse(myColMonth, out parsedMonth) && parsedMonth <= myMostRecentActualMonth)
{
// ...
}