quinta-feira, 28 de janeiro de 2010
Trabalho 1
Form1:
Dim neve1 As Integer, neve2 As Integer, nevetotal1 As Integer, nevetotal2 As Integer
Dim mat(1 To 1, 1 To 2) As Integer, l As Integer, ll As Integer
Private Sub Calcular_Click()
If Nome.Text = "" And Val(CC.Text) = 0 Then
x = MsgBox("Preencha o campo 'Nome' e 'CC' ", vbOKOnly + vbExclamation, "Campo Obrigatório")
ElseIf Nome.Text = "" Then
x = MsgBox("Preencha o campo 'Nome' ", vbOKOnly + vbExclamation, "Campo Obrigatório")
ElseIf Val(CC.Text) = 0 Then
x = MsgBox("Preencha o campo 'CC' ", vbOKOnly + vbExclamation, "Campo Obrigatório")
Else
For l = 1 To 1
Picture1.Print "Nome do Cliente"
Picture1.Print Nome
Picture1.Print "Nº do Cartão de Cidadão"
Picture1.Print CC & Chr(13)
For ll = 1 To 2
neve1 = Val(snow1.Text)
neve2 = Val(snow2.Text)
snowtotal1.Caption = neve1 * 20 & " €"
mat(l, 1) = snowtotal1.Caption
snowtotal2.Caption = neve2 * 30 & " €"
mat(l, 2) = snowtotal2.Caption
Next ll
Next l
nevetotal1 = snowtotal1.Caption
nevetotal2 = snowtotal2.Caption
neveal1 = neveal1 + neve1
neveal2 = neveal2 + neve2
snowal1.Caption = neveal1
snowal2.Caption = neveal2
totalgeral.Caption = nevetotal1 + nevetotal2
totalalugueis.Caption = neveal1 + neveal2
alugueltotal = totalalugueis.Caption
End If
If Nome.Text = "" And Val(CC.Text) = 0 Then
Calcular.Enabled = True
ElseIf Nome.Text = "" Then
Calcular.Enabled = True
ElseIf Val(CC.Text) = 0 Then
Calcular.Enabled = True
Else
Calcular.Enabled = False
Imprimir.Enabled = True
Limpar.Enabled = True
LimparTudo.Enabled = True
End If
End Sub
Private Sub Limpar_Click()
Nome.Text = ""
CC.Text = ""
snow1.Text = ""
snow2.Text = ""
snowtotal1.Caption = ""
snowtotal2.Caption = ""
totalgeral.Caption = ""
Calcular.Enabled = True
Limpar.Enabled = False
Imprimir.Enabled = False
End Sub
Private Sub LimparTudo_Click()
Nome.Text = ""
CC.Text = ""
snow1.Text = ""
snow2.Text = ""
snowtotal1.Caption = ""
snowtotal2.Caption = ""
totalgeral.Caption = ""
neveal1 = 0
snowal1.Caption = ""
neveal2 = 0
snowal2.Caption = ""
alugueltotal = 0
totalalugueis.Caption = ""
Calcular.Enabled = True
Limpar.Enabled = False
LimparTudo.Enabled = False
Imprimir.Enabled = False
End Sub
Private Sub Imprimir_Click()
Calcular.Enabled = False
Limpar.Enabled = False
LimparTudo.Enabled = False
Imprimir.Enabled = False
Form2.Show
End Sub
Private Sub Sair_Click()
Picture1.Visible = False
Picture2.Visible = True
MsgBox "Obrigado pela sua visita!", vbOKOnly + vbInformation, "BOA QUEDA - Sair"
End
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Form2:
Private Sub Form_Load()
Label1.Caption = neveal1
Label2.Caption = neveal2
Label3.Caption = alugueltotal
End Sub
Private Sub Label5_Click()
Form2.Hide
End Sub
Module:
Public neveal1 As Integer, neveal2 As Integer, alugueltotal As Integer
Subscrever:
Enviar feedback (Atom)
Sem comentários:
Enviar um comentário