Home > front end >  How to combine Do Until with an Or condition?
How to combine Do Until with an Or condition?

Time:12-30

I want 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

CodePudding user response:

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!

  •  Tags:  
  • vba
  • Related