1.
Private Sub Command1_Click()
Dim peso As Integer, indice As Integer
Label5.Caption = ""
peso = Val(Text1.Text)
indice = Combo1.ListIndex
If peso < 0 Then
MsgBox "Peso inválido", vbCritical, "Aviso"
End If
If indice = -1 Then
MsgBox "Não selecionou o destino", vbCritical, "Aviso"
End If
If Text2.Text = "" Then
MsgBox "Tem de inserir o endereço", vbCritical, "Aviso"
End If
If peso >= 0 Or Text2.Text <> "" Then
Select Case indice
Case 0
Label5.Caption = peso / 200 * 43 & "€"
Case 1
Label5.Caption = peso / 200 * 48 & "€"
Case 2
Label5.Caption = peso / 200 * 50 & "€"
Case 3
Label5.Caption = peso / 200 * 47 & "€"
Case 4
Label5.Caption = peso / 200 * 52 & "€"
Case 5
Label5.Caption = peso / 200 * 51 & "€"
End Select
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Combo1.AddItem "América do Sul"
Combo1.AddItem "América do Norte"
Combo1.AddItem "Europa"
Combo1.AddItem "África"
Combo1.AddItem "Ásia"
Combo1.AddItem "Resto do mundo"
End Sub
Código:
Private Sub CmdAdd_Click()
Dim texto As String
texto = TxtItem.Text
If texto = "" Then
MsgBox "Não escreveu nada na caixa de texto", vbCritical, "Aviso"
Else
LstLista.AddItem texto
End If
TxtItem.Text = ""
End Sub
Private Sub CmdLimpa_Click()
LstLista.Clear
End Sub
Private Sub CmdRemove_Click()
Dim indice As Integer
indice = LstLista.ListIndex
LstLista.RemoveItem indice
End Sub
Private Sub Command4_Click()
End
End Sub
Sem comentários:
Enviar um comentário