Rather try something like:
Dim num as Integer Console.Write("Enter num: ") While (Not (Integer.TryParse(num, Console.ReadLine()))) Console.WriteLine("Please enter an Integer only: ") End While
The TryParse method tries to parse the input value and returns false when the value cannot be parsed by the specified type. The above code will ask for the values used to enter until they enter an integer.
source share