pro13
sintassi per variabili e principali funzioni
VISUAL BASIC e VBA TIPI INTERI INTEGER...LONG DECIMALI SINGLE....DOUBLE..CURRENCY STRINGA STRING BOLEANI TRUE,FALSE DATE VARIANT UTENTE
INDICIZZATE ASSEGNAZIONE valore x=dato OPERATORI vari AND,OR,NOT,>,<,<>... DICHIARAZIONE con DIM nome e tipo dim x as integer dim a,b,c as integer dim a as integer,b as integer dim a as integer,x as string
assoluto abs(x) segno sgn(x) intero int(x) quadrato sqr(x) casuale rnd() esponenziale exp(x) logaritmo n. log(x) logaritmo d. log(x)/log(10) potenza x^n seno sin(x) coseno cos(x) tangente tan(x) arcotangente atn(x)
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 |
VISUAL BASIC Private Sub CommandButton1_Click() Dim a, b, c As String Dim x As Integer b = "maria" c = "rosa" a = "laudare" Label1.Caption = Len(a) x = Len(a) Label2.Caption = Right$(a, x - 3) Label3.Caption = Left$(a, x - 1) Label4.Caption = Mid$(a, 2, 2) Label5.Caption = "maria" + "rosa" Label6.Caption = b + c Label7.Caption = b & c End Sub
7 dare laudar au mariarosa mariarosa mariarosa