O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing Program Code Conditionally

The Boolean data type is usually required when evaluating decisions, and used to control whether program code is executed or not, depending on its value. Such decision-making statements include If, Case [Is], While, or Until.

The function IIf does not control the program execution but should be mentioned here because of its resemblance to the If statement. IIf returns a function result based on a passed-in Boolean value or expression. When the passed-in value or expression is True, IIf returns one result; if it is False, it returns the second.

If ... Then ... Else ... ElseIf ... End If

It is likely that you have employed the If statement many, many times, and you probably have its use down pat. But in the interest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required