1.
Código:
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "Campo em branco", vbCritical, "Aviso"
Else
List1.AddItem Text1.Text
List2.AddItem Text2.Text
List3.AddItem Text3.Text
List4.AddItem subtotal
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command3_Click()
Dim indice As Integer
If List1.ListIndex = -1 Then
MsgBox "Selecione o item que quer eliminar", vbCritical, "Aviso"
Else
indice = List1.ListIndex
List1.RemoveItem indice
List2.RemoveItem indice
List3.RemoveItem indice
List4.RemoveItem indice
End If
End Sub
Private Sub Command4_Click()
Dim cont As Integer, i As Integer, pagar As Single
cont = List3.ListCount
For i = 0 To cont - 1
pagar = pagar + List3.List(i)
Next i
total.Caption = pagar & "€"
End Sub
Private Sub Form_Load()
List2.Enabled = False
List3.Enabled = False
List4.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
End Sub
Private Sub Text1_Change()
Text2.Enabled = True
End Sub
Private Sub Text2_Change()
Text3.Enabled = True
End Sub
Private Sub Text3_Change()
subtotal.Caption = Text2.Text * Text3.Text & "€"
End Sub
Sem comentários:
Enviar um comentário