New to VB, need help with comparing non-numerical and numerical data.
I am doing my first homework assignment for my Visual Basic college class, so I'm pretty new with this language. I'm pretty familiar with programming and structure in general, so don't feel like you have to talk down to me. =]
Ok, here's my problem (i searched the help for at least an hour looking for this answer, help would be appreciated): I'm making a simple program that asks for the radius of a circle and calculates area, circumference, etc. The problem occurs when I enter a non-numerical value, the program can't multiply 2 by a space or the letter z.
Can anybody tell me a way to check if the string is a non-numerical value and save the result as True or False? Any other suggestions would help, too. Thanks!
Module
close =
"n"While close <>"Y"Console.Out.WriteLine()
Console.Out.WriteLine(
"What is the radius?")radius = Console.In.ReadLine()
Console.Out.WriteLine(
"The Diameter is: " & 2 * radius)Console.Out.WriteLine(
"The Area of the circle is: " & radius * radius * Math.PI)Console.Out.WriteLine(
"The Circumference of the circle is: " & 2 * Math.PI * radius)Console.Out.WriteLine()
Console.Out.WriteLine(
"Close? (Y/N)")close = Console.In.ReadLine()
If close ="y"Thenclose =
"Y"EndIfEndWhileEndSubEnd
Module
