Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

hey I'm relatively new at visual basic, and im having issues with my random password generator

I was trying to make a set of standards which the generator would have to follow but its saying "System.InvalidCastException: ‘Conversion from string "no" to type ‘Boolean’ is not valid.’"

Dim capitals As String
Do Until capitals = "yes" Or "no"
            Console.WriteLine("do you want your password to include capitals")
            capitals = Console.ReadLine
        Loop

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Use:

Do Until capitals = "yes" Or capitals = "no"

This is because, in programming or separates two whole statements which can come out as a Boolean at the end.

The conditions in the original code:
• `Until capitals = "yes"
• "no"

This definitely isn’t what you want, you’re supposed to have Until Capitals = both sides!

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading