You would think there would be a way using DirectCast, TryCast, CType etc but all of them seem to choke on it e.g.:
CType("Yes", Boolean)
You get:
System.InvalidCastException –
Conversion from string “Yes” to type
‘Boolean’ is not valid.
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.
If you think about it, “yes” cannot be converted to bool because it is a language and context specific string.
“Yes” is not synonymous with true (especially when your wife says it…!). For things like that you need to convert it yourself; “yes” means “true”, “mmmm yeeessss” means “half true, half false, maybe”, etc.