pro5
VISUAL BASIC istruzioni da inserire in PULSANTE ATTIVA(+2 textbox e 1 label)
creare PULSANTE e 2 caselle Textbox e 1 casella Label
inserire istruzioni in PULSANTE
ATTIVA con istruzioni |
Option Explicit Private Sub CommandButton1_Click() 'esegue prodotto solo per numeri positivi Dim a, b, somma As Integer a = TextBox1 b = TextBox2 If a <= 0 Or b <= 0 Then Label4.Caption = ("solo numeri positivi") Else Label4.Caption = a * b End If End Sub
scrivere due interi positivi in caselle textbox1,textbox2 poi ATTIVA
textbox1 con a da inserire |
textbox2 con b da inserire |
label14 con a*b |
ATTIVA con istruzioni |
pro18
selezione con IF..THEN...ELSE visualbasic
VISUAL BASIC creare PULSANTE per istruzioni e 9 caselle LABEL
PULSANTE |
Private Sub CommandButton1_Click() Dim a, b, c, d As Integer a = 10 b = 20 c = 30 d = 40 If a > b Then Label1.Caption = a * b If a < b Then Label2.Caption = a + b If a < b Then Label3.Caption = a + b Label4.Caption = a * b Label5.Caption = a - b End If If a < b Then Label6.Caption = a + b Label7.Caption = a * b Else Label8.Caption = a * 10 Label9.Caption = b * 100 End If End Sub
label1 | label2 | label3 | label4 | label5 | label6 | label7 | label8 | label9 |
label1 | 30...... | 30...... | 200.... | -10..... | 30...... | 200.... | label8 | label9 |