Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Test for non-zero


'converting numbers to Boolean: 0 is FALSE, all others are true
'converting Boolean to a number:  TRUE becomes -1,  FALSE becomes 0

If var Then
    'this section executes if var is non-zero
End If

'or this approach
If var <> 0 Then
    'this section executate if var is non-zero
End If