pro17

VISUAL_ sintassi per variabili booleane


VISUAL BASIC e VBA
End SubPrivate Sub CommandButton1_Click()
Dim a, b, c, d As Integer
Dim conferma As Boolean
a = Cells(1, 1)
b = Cells(1, 2)
c = Cells(1, 3)
d = Cells(1, 4)
If a > b Then
Cells(2, 1) = a - b
End If
If a < b Then
Cells(2, 2) = b - a
End If
If a >= b Then
Cells(2, 3) = a - b
End If
If a > b Then
Cells(3, 1) = a - b
 Else
  Cells(3, 2) = b - a
  End If
If a < b And c < d Then
Cells(4, 1) = a * 10
 Else
  Cells(4, 2) = a * 100
  End If
If a < b Or c > d Then
Cells(5, 1) = a * 5
 Else
  Cells(5, 2) = a * 8
  End If
conferma = False
If a < b Then
conferma = True
If conferma Then
Cells(6, 1) = a * a
End If
End If
conferma = False
If a > b Then
conferma = True
If conferma Then
Cells(7, 1) = a * a
End If
Else
Cells(7, 2) = b * a
End If

end sub
  A B C D
1 10 50 100 200
2   40    
3   40    
4 100      
5 50      
6 100      
7   500    
8        

ritorna

VISUAL BASIC boolean
Private Sub CommandButton1_Click()
Dim a, b, c, d As Integer
Dim conferma As Boolean
a = 10
b = 50
c = 100
d = 200

Label1.Caption = a
Label2.Caption = b
Label3.Caption = c
Label4.Caption = d

If a > b Then
Label5.Caption = a - b

End If
If a < b Then
Label6.Caption = b - a
End If
If a >= b Then
Label7.Caption = a - b
End If

If a > b Then
Label8.Caption = a - b
Else
Label9.Caption = b - a
End If
If a < b And c < d Then
Label10.Caption = a * 10
Else
Label11.Caption = a * 100
End If

If a < b Or c > d Then
Label12.Caption = a * 5
Else
Label13.Caption = a * 8
End If
conferma = False
If a < b Then
conferma = True
If conferma Then
Label14.Caption = a * a
End If
End If

conferma = False
If a > b Then
conferma = True
If conferma Then
Label15.Caption = a * a
End If
Else
Label16.Caption = b * a
End If

End Sub

label1 label2 label3 label4 label5 label6
label7 label8 label9 label10 label1 label12
label13 label14 label15 label16   PULSANTE

ritorna

		

inizio