sintassi e uso di procedure con visual basic
procedure attivate usando dati forniti da programma
Private Sub provax(a As Integer, b As Integer, c As Integer)
Dim totale As Integer
If (a > 0) And (b > 0) And (c > 0) Then
totale = a + b + c
MsgBox ("somma=" & totale)
Else
MsgBox ("almeno un numero minore di 0=") & a + b + c
End If
End Sub
Private Sub CommandButton1_Click() Call provax(1, 2, 3) Call provax(0, 1, 2) Call provax(1, 2, -6) End Sub
Private Sub provay(a As Integer, b As Integer, c As Integer)
Dim totale As Integer
If (a > 0) And (b > 0) And (c > 0) Then
totale = a * b * c
MsgBox ("prodotto=" & totale)
Else
MsgBox ("almeno un numero minore o uguale di 0=") & a * b * c
End If
End Sub
Private Sub CommandButton2_Click() Call provay(1, 2, 10) Call provay(0, 2, 8) End Sub
Private Sub provaz(a As Integer, b As Integer, c As Integer)
Dim totale As Integer
If ((a > 0) And (b > 0)) Or (c < 0) Then
totale = a + b + c
MsgBox ("somma=" & totale)
Else
MsgBox ("almeno un numero minore di 0")
End If
End Sub
Private Sub CommandButton3_Click() Call provaz(0, -2, -4) Call provaz(-3, 4, 2) End Sub
Private Sub UserForm_Click()
End Sub