dcsimg
June 19, 2018
Hot Topics:

Basics of VB Programming

  • November 19, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

The If..Then..Else statement is one used a lot by programmers. It checks if a certain condition is true and then executes a statement. The Else statement is used if the statement does not comply with the criteria. e.g.

Dim i As Integer
i=10
If i=10 Then
Msgbox "i=10"
Else
Msgbox "i is not 10"
End If

You can also use nested If..Then..Else statements. e.g.

Dim i As Integer
i=10
If i=10 Then
If i>9 Then
Msgbox "i>9"
Else
Msgbox "i<9"
End If
Msgbox "i=10"
Else
Msgbox "i does not = 10"
End If

Easy.





Page 6 of 6



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date