hello friends,
i've made some console application to display ascii code but i got an exception when try it..
the result :
enter any character :
a
ASCII COde from character a = 97
Press any key to continue . . .
but when i tried pressing enter button without entering any character it shows error :
Unhandled Exception: System.ArgumentException: Length of argument 'String' must
be greater than zero.
at Microsoft.VisualBasic.Strings.Asc(String String)
at StringASCII.Module1.Main() in D:\StringASCII\Module1.vb:line 36
Press any key to continue . . .
my question is :
1. how i can trap / detect enter button without entering any character so it won't show any error
thank u so much for any replies
i've made some console application to display ascii code but i got an exception when try it..
VB.NET:
sub main()
Console.WriteLine("enter any character : ")
Dim chr As String = Console.ReadLine
Console.WriteLine("ASCII COde from character {0} = {1}", chr, Asc(chr))
end sub()
the result :
enter any character :
a
ASCII COde from character a = 97
Press any key to continue . . .
but when i tried pressing enter button without entering any character it shows error :
Unhandled Exception: System.ArgumentException: Length of argument 'String' must
be greater than zero.
at Microsoft.VisualBasic.Strings.Asc(String String)
at StringASCII.Module1.Main() in D:\StringASCII\Module1.vb:line 36
Press any key to continue . . .
my question is :
1. how i can trap / detect enter button without entering any character so it won't show any error
thank u so much for any replies