So here's the problem, I have a variable called Denary which is an integer as I need to do maths with it. If someone using my program were to type in a
letter instead of a number it would crash. I would prefer to be able to post an error message but it crashes at the console.ReadLine so my knowledge leaves me unable to solve it.
Code:Console.WriteLine("Type a denary number between 0 and 255 to convert or press * to return to the main menu") Denary = Console.ReadLine 'Reads in the Denary Number If Denary > 0 And Denary < 255 Then Do While Denary > 0 Binary(i) = Denary Mod 2 Denary = Fix(Denary / 2) 'Divides Denary number by 2 and rounds dpwn i = i + 1 Loop




Reply With Quote