pro28

gestione PROCEDURE e FUNZIONE

Private Sub CommandButton1_Click()
Dim b As Integer
Dim a As Integer
a = label1.caption
b = label2.caption
Call calcolare(a, b)
End Sub


Public Sub calcolare(a As Integer, b As Integer)
Dim somma, prodotto As Integer
somma = a + b
prodotto = a * b
label3.caption = somma
label4.caption=prodotto
End Sub

creare PULSANTE,4 label per inserire e visualizzare dati

PULSANTE
label1 label2 label3 label4
20...... 30...... 50...... 600....

 



gestione di FUNCTION con VISUAL BASIC

Option Explicit

Private Sub CommandButton1_Click()
Dim a As Integer
Dim b As Integer
Dim x As Integer
Dim y As Integer
a = 5
b = 6
label1.caption = esegue(a, b)
x = label2.caption
y = label3.caption
label4.caption = esegue(x, y)
End Sub


Public Function esegue(a As Integer, b As Integer)
Dim somma As Integer
somma = a + b
esegue = somma
End Function
creare PULSANTE per istruzioni e 4 label per inserire e visualizzare dati
PULSANTE
label1
label2
label3
label4
11......
10......
20......
30......

inizio