This evaluation of logical expressions is known as "short-circuit evaluation" (Short-Circuit Evaluation): Short-Circuit Evaluation
Unlike C#
for example, in VB
this validation is not performed, that is, in a sequence of logical operators, all are validated until determining whether the expression is true or false, for example:
If a > b And b > a And b <> a Then
In VB.Net
, there are operators AndAlso
and OrElse
who do this.
Here is an answer from the OS in English on this subject: https://stackoverflow.com/questions/4014918/does-vb6-short-circuit-complex-conditions
The answers confirm that there is no resource at VB6
, and the suggestions are to validate in smaller blocks with Then If
and Select Case
Read more (in English) here: Short-Circuit Evaluation in Visual Basic.Net
I’m not sure if VB6 has it (VB.NET has it), but it experiences the Andalso condition instead of the And
– Renato Afonso