Export (0) Print
Expand All

IsFalse Operator (Visual Basic)

Determines whether an expression is False.

You cannot call IsFalse explicitly in your code, but the Visual Basic compiler can use it to generate code from AndAlso clauses. If you define a class or structure and then use a variable of that type in an AndAlso clause, you must define IsFalse on that class or structure.

The compiler considers the IsFalse and IsTrue operators as a matched pair. This means that if you define one of them, you must also define the other one.

NoteNote

The IsFalse operator can be overloaded, which means that a class or structure can redefine its behavior when its operand has the type of that class or structure. If your code uses this operator on such a class or structure, be sure you understand its redefined behavior. For more information, see Operator Procedures (Visual Basic).

The following code example defines the outline of a structure that includes definitions for the IsFalse and IsTrue operators.


Public Structure p
    Dim a As Double
    Public Shared Operator IsFalse(ByVal w As p) As Boolean
        Dim b As Boolean
        ' Insert code to calculate IsFalse of w.
        Return b
    End Operator
    Public Shared Operator IsTrue(ByVal w As p) As Boolean
        Dim b As Boolean
        ' Insert code to calculate IsTrue of w.
        Return b
    End Operator
End Structure


Community Additions

ADD
Show:
© 2014 Microsoft