Console App : Use Switch Function to Check the Entered Character is Numeric Or String

Posted by Chikul under VB.NET category on | Views : 4646

Module Module1

Sub Main()
Dim str As String
Dim Bool As Boolean
Console.WriteLine("Enter Value :")
str = Console.ReadLine()
bool = Microsoft.VisualBasic.Switch(IsNumeric(str), True, Not IsNumeric(str), False)
If Bool Then
Console.WriteLine("Number Entered")
Console.WriteLine("Character Entered")
End If
End Sub

End Module

Comments or Responses

Login to post response