the compilation of
Dim mySingle As Single = “”
is ok, but at runtime it throw an exception: Conversion from string “” to type ‘Single’ is not valid.
How could it be possible?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Strings aren’tSingles.It compiles because you don’t have
Option Strict.Without
Option Strict On(either at the top of the file or preferably in project properties), all type-checking happens at runtime; there is no compile time type-safety.You should ALWAYS use
Option Strict.