' The IF statement is the first thing i learned in programming.
' IF? is your questions to the application, so that you can
' decide what is going to happen next..
' if a counter is 10 then set it back to 0
' if you don't have any money left, you can't buy that dvd-player.
' if your character fall more than 3 units in a game, then he loses energy etc.
Dim num As Integer
Dim strReply As String
Private Sub Form_Load()
'Ask our question when the program loads
Label1.Caption = "How many cars do you have?"
Private Sub Command1_Click()
num = Int(Text1.Text) 'Input
If (num > 0) Then
strReply = "You have a car!"
strReply = "You don't have a car!"
If (num > 1) Then strReply = "Are you rich!"
'display our comment
Label1.Caption = strReply
'sometimes you just need one if statement
'IF (?) Then do this
'IF (?) Then
' do this
'sometimes you ned two or more if statements
'If (question1?) Then to this
'If (question2?) Then to that
'sometimes it is easier to use if else
'If(question1?) Then to this Else do that
'sometimes it is easier to use if else if
' I have tried to demonstrate different ways to use if tests
' It all depend on the "situation", and how you prefer to do your programming...
||Visual Basic Source Code
I hope you found this Visual Basic tutorial useful!
Don't forget to mention Apron Tutorials in your References!
Ronny André Reierstad