quarta-feira, 17 de fevereiro de 2010

Ficha 22 - Em base de Dados







Private Sub Sair_Click()

If MsgBox("Deseja sair?", vbYesNo + vbQuestion, " Aviso") = vbYes Then End

End Sub

Private Sub cmdPrimeiro_Click()
If Data1.Recordset.BOF Then
MsgBox " Base de dados vazia"
Else
Data1.Recordset.MoveFirst
End If

End Sub
Private Sub cmdSeguinte_Click()

If Data1.Recordset.EOF Then
If Data1.Recordset.BOF Then
MsgBox "Base de Dados vazia!"
End If
Else
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
End If
End If

End Sub
Private Sub cmdAnterior_Click()

If Data1.Recordset.BOF Then
If Data1.Recordset.EOF Then
MsgBox "Base de Dados vazia!"
End If
Else
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
End If
End If

End Sub
Private Sub cmdUltimo_Click()
If Data1.Recordset.EOF Then
MsgBox " Base de dados vazia"
Else
Data1.Recordset.MoveLast
End If

End Sub

Private Sub Form_Load()

cmdGuardar.Enabled = False

End Sub
Private Sub cmdAdicionar_Click()

If cmdAdicionar.Caption = "Adicionar" Then
Data1.Recordset.AddNew
txtcodigo.SetFocus
txtfuncionario.SetFocus
txtsalario.SetFocus
txtvale.SetFocus


cmdEliminar.Enabled = False
cmdGuardar.Enabled = True
cmdAdicionar.Caption = "Cancelar"
Else

cmdEliminar.Enabled = True
cmdGuardar.Enabled = False
cmdAdicionar.Caption = "Adicionar"
End If

End Sub
Private Sub cmdGuardar_Click()

Dim Resp As Integer, Mens As String

If txtcodigo.Text = Empty Then

MsgBox "Preencha o campo Código", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtfuncionario.Text = Empty Then

MsgBox "Preencha o campo Funcionário", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtsalario.Text = Empty Then

MsgBox "Preencha o campo Salário", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtvale.Text = Empty Then

MsgBox "Preencha o campo Vale", vbOKOnly + vbExclamation, " Aviso"

Else
Mens = "Deseja guardar os novos dados?"
Resp = MsgBox(Mens, vbYesNo + vbQuestion, "Question")

If Resp = vbYes Then
txttotal.Text = Val(txtsalario.Text) + Val(txtvale.Text)

Data1.Recordset.Update
cmdEliminar.Enabled = True
cmdGuardar.Enabled = False
cmdAdicionar.Caption = "Adicionar"
End If
End If

End Sub
Private Sub cmdEliminar_click()

If MsgBox("Deseja eliminar este registo?", vbYesNo + vbQuestion, "Question") = vbNo Then
MsgBox "Registo não eliminado"
Else
Data1.Recordset.Delete
Data1.Recordset.MoveNext

If Data1.Recordset.EOF Then
Data1.Recordset.MovePrevious

If Data1.Recordset.BOF Then
MsgBox "Não há registos"
cmdEliminar.Enabled = False
End If

End If
MsgBox "Registo Eliminado"
End If

End Sub

Private Sub Retroceder_Click()

End Sub

Private Sub Timer1_Timer()

Hora_Data = Now

End Sub

Private Sub txtcodigo_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

Private Sub txtfuncionario_KeyPress(KeyAscii As Integer)

Select Case KeyAscii
Case vbKeyDelete
Case vbKeyBack
Case 65 To 90
Case 97 To 122
Case 32
Case Else
Beep
KeyAscii = 0
End Select

End Sub

Private Sub txtsalario_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

Private Sub txtvale_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

domingo, 7 de fevereiro de 2010

Ficha 23





Private Type Folha

matricula As Long
nome As String * 40
nota1 As Long
nota2 As Long
media As Single

End Type

Dim tabela(19) As Folha

Dim i As Integer, j As Integer

Private Sub Avancar2_Click()

mensagem.Enabled = False
Limpar.Enabled = True
retroceder.Enabled = True
Retroceder2.Enabled = True

If j < i - 1 Then

j = j + 1

ver_dados (j)

End If

If j = i - 1 Then

avancar.Enabled = False
Avancar2.Enabled = False

End If

End Sub

Private Sub retroceder_Click()

mensagem.Enabled = False
Limpar.Enabled = True
avancar.Enabled = True
Avancar2.Enabled = True

If j > 0 Then

j = j - 1

ver_dados (j)

End If

If j = 0 Then

retroceder.Enabled = False
Retroceder2.Enabled = False

End If

End Sub

Private Sub avancar_Click()

mensagem.Enabled = False
Limpar.Enabled = True
retroceder.Enabled = True
Retroceder2.Enabled = True


If j < i - 1 Then

j = j + 1

ver_dados (j)

End If

If j = i - 1 Then

avancar.Enabled = False
Avancar2.Enabled = False

End If

End Sub

Private Sub Form_Load()

i = 0

End Sub

Private Sub mensagem_Click()



If txtmatricula.Text = Empty Then

MsgBox "Preencha o campo Matrícula", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtnome.Text = Empty Then

MsgBox "Preencha o campo Nome", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtnota1.Text = Empty Then

MsgBox "Preencha o campo Nota 1", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtnota2.Text = Empty Then

MsgBox "Preencha o campo Nota 2", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtnota1.Text < 0 Or txtnota1.Text > 20 Then

MsgBox "Nota 1 excedida", vbOKOnly + vbCritical, " Aviso"

ElseIf txtnota2.Text < 0 Or txtnota2.Text > 20 Then

MsgBox "Nota 2 excedida", vbOKOnly + vbCritical, " Aviso"

Else

tabela(i).matricula = txtmatricula.Text
tabela(i).nome = txtnome.Text
tabela(i).nota1 = txtnota1.Text
tabela(i).nota2 = txtnota2.Text

MsgBox "Dados Inseridos", vbOKOnly + vbInformation, " Mensagem"

txtmedia.Text = (Val(txtnota1.Text) + Val(txtnota2.Text)) / 2
tabela(i).media = (Val(txtnota1.Text) + Val(txtnota2.Text)) / 2

i = i + 1
j = i

mensagem.Enabled = False
retroceder.Enabled = False
Retroceder2.Enabled = False
avancar.Enabled = False
Avancar2.Enabled = False
Limpar.Enabled = True

End If

End Sub

Private Sub Limpar_Click()

txtmatricula.Text = ""
txtnome.Text = ""
txtnota1.Text = ""
txtnota2.Text = ""
txtmedia.Text = ""

mensagem.Enabled = True
retroceder.Enabled = True
Retroceder2.Enabled = True
avancar.Enabled = True
Avancar2.Enabled = True
Limpar.Enabled = False

End Sub

Private Sub Retroceder2_Click()

mensagem.Enabled = False
Limpar.Enabled = True
avancar.Enabled = True
Avancar2.Enabled = True

If j > 0 Then

j = j - 1

ver_dados (j)

End If

If j = 0 Then

retroceder.Enabled = False
Retroceder2.Enabled = False

End If

End Sub

Private Sub Sair_Click()

If MsgBox("Deseja sair?", vbYesNo + vbQuestion, " Aviso") = vbYes Then End

End Sub

Private Sub Timer1_Timer()

Hora_Data = Now

End Sub
Private Sub ver_dados(k As Integer)

txtmatricula.Text = tabela(k).matricula
txtnome.Text = tabela(k).nome
txtnota1.Text = tabela(k).nota1
txtnota2.Text = tabela(k).nota2
txtmedia.Text = tabela(k).media

End Sub

Private Sub txtmatricula_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

Private Sub txtnome_KeyPress(KeyAscii As Integer)

Select Case KeyAscii
Case vbKeyDelete
Case vbKeyBack
Case 65 To 90
Case 97 To 122
Case 128 To 154
Case 159 To 165
Case 32
Case Else
Beep
KeyAscii = 0
End Select

End Sub

Private Sub txtnota1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

Private Sub txtnota2_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

quinta-feira, 4 de fevereiro de 2010

Ficha 22







~Private Type Folha

codigo As Long
funcionario As String * 40
salario As Long
vale As Long
total As Long

End Type

Dim tabela(11) As Folha

Dim i As Integer, j As Integer

Private Sub Avancar2_Click()

Incluir.Enabled = False
Limpar.Enabled = True
Retroceder.Enabled = True
Retroceder2.Enabled = True

If j < i - 1 Then

j = j + 1

ver_dados (j)

End If

If j = i - 1 Then

Avancar.Enabled = False
Avancar2.Enabled = False

End If

End Sub

Private Sub retroceder_Click()

Incluir.Enabled = False
Limpar.Enabled = True
Avancar.Enabled = True
Avancar2.Enabled = True

If j > 0 Then

j = j - 1

ver_dados (j)

End If

If j = 0 Then

Retroceder.Enabled = False
Retroceder2.Enabled = False

End If

End Sub

Private Sub avancar_Click()

Incluir.Enabled = False
Limpar.Enabled = True
Retroceder.Enabled = True
Retroceder2.Enabled = True


If j < i - 1 Then

j = j + 1

ver_dados (j)

End If

If j = i - 1 Then

Avancar.Enabled = False
Avancar2.Enabled = False

End If

End Sub

Private Sub Form_Load()

i = 0

End Sub

Private Sub Incluir_Click()


If txtcodigo.Text = Empty Then

MsgBox "Preencha o campo Código", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtfuncionario.Text = Empty Then

MsgBox "Preencha o campo Funcionário", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtsalario.Text = Empty Then

MsgBox "Preencha o campo Salário", vbOKOnly + vbExclamation, " Aviso"

ElseIf txtvale.Text = Empty Then

MsgBox "Preencha o campo Vale", vbOKOnly + vbExclamation, " Aviso"

Else

tabela(i).codigo = txtcodigo.Text
tabela(i).funcionario = txtfuncionario.Text
tabela(i).salario = txtsalario.Text
tabela(i).vale = txtvale.Text

MsgBox "Dados Inseridos", vbOKOnly + vbInformation, " Mensagem"

txttotal.Text = Val(txtsalario) + Val(txtvale.Text)
tabela(i).total = Val(txtsalario) + Val(txtvale.Text)

i = i + 1
j = i

Incluir.Enabled = False
Retroceder.Enabled = False
Retroceder2.Enabled = False
Avancar.Enabled = False
Avancar2.Enabled = False
Limpar.Enabled = True

End If

End Sub

Private Sub Limpar_Click()

txtcodigo.Text = ""
txtfuncionario.Text = ""
txtsalario.Text = ""
txtvale.Text = ""
txttotal.Text = ""

Incluir.Enabled = True
Retroceder.Enabled = True
Retroceder2.Enabled = True
Avancar.Enabled = True
Avancar2.Enabled = True
Limpar.Enabled = False

End Sub

Private Sub Retroceder2_Click()

Incluir.Enabled = False
Limpar.Enabled = True
Avancar.Enabled = True
Avancar2.Enabled = True

If j > 0 Then

j = j - 1

ver_dados (j)

End If

If j = 0 Then

Retroceder.Enabled = False
Retroceder2.Enabled = False

End If

End Sub

Private Sub Sair_Click()

If MsgBox("Deseja sair?", vbYesNo + vbQuestion, " Aviso") = vbYes Then End

End Sub

Private Sub Timer1_Timer()

Hora_Data = Now

End Sub
Private Sub ver_dados(k As Integer)

txtcodigo.Text = tabela(k).codigo
txtfuncionario.Text = tabela(k).funcionario
txtsalario.Text = tabela(k).salario
txtvale.Text = tabela(k).vale
txttotal.Text = tabela(k).total

End Sub

Private Sub txtcodigo_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

Private Sub txtfuncionario_KeyPress(KeyAscii As Integer)

Select Case KeyAscii
Case vbKeyDelete
Case vbKeyBack
Case 65 To 90
Case 97 To 122
Case 32
Case Else
Beep
KeyAscii = 0
End Select

End Sub

Private Sub txtsalario_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

Private Sub txtvale_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub

sexta-feira, 29 de janeiro de 2010

Ficha 21



Const PI = 3.14

Private Function VCilindro(x As Single, z As Single) As Single
VCilindro = PI * x ^ 2 * z
End Function
Private Function ACirculo(x As Single) As Single
ACirculo = PI * x ^ 2
End Function
Private Function VCubo(x As Single) As Single
VCubo = x ^ 3
End Function
Private Function AEsfera(x As Single) As Single
AEsfera = 4 * PI * x ^ 2
End Function
Private Function VEsfera(x As Single) As Single
VEsfera = 4 / 3 * PI * x ^ 3
End Function
Private Function AQuadrado(x As Single) As Single
AQuadrado = x * x
End Function
Private Function PQuadrado(x As Single) As Single
PQuadrado = x * x * x * x
End Function
Private Function ARectangulo(x As Single, z As Single) As Single
ARectangulo = x * z
End Function
Private Function PRectangulo(x As Single, z As Single) As Single
PRectangulo = 2 * (x + z)
End Function
Private Function ATriangulo(x As Single, z As Single) As Single
ATriangulo = x * z / 2
End Function
Private Function PTriangulo(x As Single) As Single
PTriangulo = x + x + x
End Function

Private Sub Autor_Click()

MsgBox "Programa protagonizado por João Florindo", vbOKOnly, "Exercício - Autor"

End Sub

Private Sub Cilindro_Click()

Dim r As Single, h As Single, v As Single

Do
r = Val(InputBox("Digite o valor do raio", "Volume do Cilindro"))
Loop While r <= 0
Do
h = Val(InputBox("Digite o valor da altura", "Volume do Cilindro"))
Loop While h <= 0

v = VCilindro(r, h)

MsgBox "O volume do cilindro é " & v & "m2", 64, " Volume do Cilindro"


End Sub

Private Sub Circulo_Click()

Dim r As Single, a As Single

Do
r = Val(InputBox("Digite o valor do raio", "Área do Círculo"))
Loop While r <= 0

a = ACirculo(r)

MsgBox "A área do círculo é " & a & "m2", 64, " Área do Círculo"

End Sub

Private Sub Cubo_Click()

Dim v As Single, a As Single

Do
a = Val(InputBox("Digite o valor da aresta", "Volume do Cubo"))
Loop While a <= 0

v = VCubo(a)

MsgBox "O volume do cubo é " & v & "m2", 64, " Volume do Cubo"

End Sub

Private Sub Esfera_Click()

Dim a As Single, r As Single

Do
r = Val(InputBox("Digite o valor da esfera", "Área da Esfera"))
Loop While r <= 0

a = AEsfera(r)

MsgBox "A área da esfera é " & a & "m2", 64, " Área da Esfera"

End Sub

Private Sub Esfera2_Click()

Dim v As Single, r As Single

Do
r = Val(InputBox("Digite o valor da esfera", "Volume da Esfera"))
Loop While r <= 0

v = VEsfera(r)

MsgBox "O volume da esfera é " & v & "m2", 64, " Volume da Esfera"

End Sub

Private Sub Quadrado_click()

Dim a As Single, l As Single

Do
l = Val(InputBox("Digite o valor do lado", "Área do Quadrado"))
Loop While l <= 0

a = AQuadrado(l)

MsgBox "A área do quadrado é " & a & "m2", 64, " Área do Quadrado"

End Sub

Private Sub Quadrado2_Click()

Dim p As Single, l As Single

Do
l = Val(InputBox("Digite o valor dos lados", "Perímetro do Quadrado"))
Loop While l <= 0

p = PQuadrado(l)

MsgBox "O perímetro do quadrado é " & p & "m2", 64, " Perímetro do Quadrado"

End Sub

Private Sub Rectangulo_Click()

Dim a As Single, b As Single, h As Single

Do
b = Val(InputBox("Digite o valor da base", "Área do Rectângulo"))
Loop While b <= 0

Do
h = Val(InputBox("Digite o valor da altura", "Área do Rectângulo"))
Loop While h <= 0

a = ARectangulo(b, h)

MsgBox "A área do rectângulo é " & a & "m2", 64, " Área do Rectângulo"

End Sub

Private Sub Rectangulo2_Click()

Dim p As Single, b As Single, h As Single

Do
b = Val(InputBox("Digite o valor da base", "Perímetro do Rectângulo"))
Loop While b <= 0

Do
h = Val(InputBox("Digite o valor da altura", "Perímetro do Rectângulo"))
Loop While h <= 0

p = PRectangulo(b, h)

MsgBox "O perímetro do rectângulo é " & p & "m2", 64, " Perímetro do Rectângulo"

End Sub

Private Sub Sair_Click()

If MsgBox("Deseja mesmo sair?", vbYesNo + vbQuestion, " Exercício - Confirmação") = vbYes Then End

End Sub

Private Sub Triangulo_Click()

Dim a As Single, b As Single, h As Single

Do
b = Val(InputBox("Digite o valor da base", "Área do Triângulo"))
Loop While b <= 0

Do
h = Val(InputBox("Digite o valor da altura", "Área do Triângulo"))
Loop While h <= 0

a = ATriangulo(b, h)

MsgBox "A área do triângulo é " & a & "m2", 64, " Área do Triângulo"

End Sub

Private Sub Triangulo2_Click()

Dim p As Single, l As Single

Do
l = Val(InputBox("Digite o valor dos lados", "Perímetro do Triângulo"))
Loop While l <= 0

p = PTriangulo(l)

MsgBox "O perímetro do triângulo é " & p & "m2", 64, " Perímetro do Triângulo"

End Sub

quinta-feira, 28 de janeiro de 2010

Trabalho 2







Form1:

Function FU_Delay(Quanto As Double, PermiteDoEvents As Integer) As Double

Dim inicio As Double
Dim Check As Double
Dim Contador As Double
Contador = Timer
inicio = Timer
Do Until Check >= (inicio + Quanto)
Check = Timer
If PermiteDoEvents Then DoEvents
Loop

FU_Delay = (Timer - Contador)
End Function

Private Sub Form_Load()
Form1.Show
If res = Sair Then
r = FU_Delay(3, True)
Form1.Hide
Form2.Show
End If
End Sub


Form2:

Dim movie As Integer, cont As Integer, total As Single, result As Single, mt As Single
Dim mat As Single
Private Sub Calcular_Click()

If Cliente.Text = "" And Val(Filmes.Text) = 0 Then
'Só poderá continuar o programa se os campos do Número do Cliente e Total de filmes a alugar estiverem preenchidos
x = MsgBox("Preencha os campos 'Número do Cliente' e 'Total de filmes a alugar' ", vbOKOnly + vbExclamation, "Campo Obrigatório")
ElseIf Cliente.Text = "" Then
'Terá que ser preenchido o campo Número Cliente para o programa continuar
x = MsgBox("Preencha o campo 'Número do Cliente' ", vbOKOnly + vbExclamation, "Campo Obrigatório")
ElseIf Val(Filmes.Text) = 0 Then
'Terá que ser preenchido o campo Total de filmes a alugar para o programa continuar
x = MsgBox("Preencha o campo 'Total de filmes a alugar' ", vbOKOnly + vbExclamation, "Campo Obrigatório")
Else

'Cont é onde começa a ser contados os clientes
cont = cont + 1

'movie é o número de filmes
movie = Val(Filmes.Text)

'É feita a multiplicação do preço dos filmes que o cliente deseja comprar
total_sem.Caption = Filmes * 2.5 & " €"

'Preço dos filmes sem desconto
mat = Round(Filmes * 2.5, 2)

'Desconto dos filmes
desconto.Caption = mat * 0.1 & " €"

'Preço dos filmes com desconto
total_com.Caption = mat - (mat * 0.1) & " €"


mt = Round(mat - (mat * 0.1), 2)


result = mt


total = Round(total + result, 2)

Total_clientes.Caption = cont
l1 = cont


Total_recebido.Caption = total & " €"
l2 = total

Limpar.Enabled = True
Imprimir.Enabled = True
Calcular.Enabled = False

End If

End Sub

Private Sub Form_Load()

cont = 0
total = 0

End Sub

Private Sub Imprimir_Click()
'Será imprimido os clientes e o total facturado numa nova form
Form3.Show
Load Form3

End Sub

Private Sub Limpar_Click()
'Neste botão a função Limpar serve para limpar os valores do cliente , o número do cliente e o total de filmes a alugar
Cliente.Text = ""
Filmes.Text = ""
total_sem.Caption = ""
desconto.Caption = ""
total_com.Caption = ""

Calcular.Enabled = True
Limpar.Enabled = False
Imprimir.Enabled = False

End Sub

Private Sub Sair_Click()
'Aqui o programa será terminado
x = MsgBox("Deseja mesmo sair?", vbYesNo + vbQuestion, "Vídeo Clube")

If x = vbYes Then
End
Else

End If

End Sub


Form3:

Private Sub Form_Load()
'Será carregado os totais calculados na form2
Label1.Caption = l1
Label2.Caption = l2 & " €"

End Sub

Private Sub Label5_Click()
'O programa voltará de novo a form2 para novos resultados
Label1.Caption = ""
Label2.Caption = ""

Form3.Hide
Unload Form3
End Sub


Module:

Public l1 As Integer, l2 As Single

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

domingo, 24 de janeiro de 2010

Ficha 20



Private Sub Alegre_Click()

S_Alegre.Visible = True
S_Triste.Visible = False
C_Copas.Visible = False
C_Ouros.Visible = False
C_Paus.Visible = False
C_Espadas.Visible = False

End Sub

Private Sub Copas_Click()

S_Alegre.Visible = False
S_Triste.Visible = False
C_Copas.Visible = True
C_Ouros.Visible = False
C_Paus.Visible = False
C_Espadas.Visible = False

End Sub

Private Sub Espadas_Click()

S_Alegre.Visible = False
S_Triste.Visible = False
C_Copas.Visible = False
C_Ouros.Visible = False
C_Paus.Visible = False
C_Espadas.Visible = True

End Sub


Private Sub Limpar_Click()

S_Alegre.Visible = False
S_Triste.Visible = False
C_Copas.Visible = False
C_Ouros.Visible = False
C_Paus.Visible = False
C_Espadas.Visible = False

End Sub

Private Sub Ouros_Click()

S_Alegre.Visible = False
S_Triste.Visible = False
C_Copas.Visible = False
C_Ouros.Visible = True
C_Paus.Visible = False
C_Espadas.Visible = False

End Sub

Private Sub Paus_Click()

S_Alegre.Visible = False
S_Triste.Visible = False
C_Copas.Visible = False
C_Ouros.Visible = False
C_Paus.Visible = True
C_Espadas.Visible = False

End Sub

Private Sub Sair_Click()

End

End Sub

Private Sub Triste_Click()

S_Alegre.Visible = False
S_Triste.Visible = True
C_Copas.Visible = False
C_Ouros.Visible = False
C_Paus.Visible = False
C_Espadas.Visible = False

End Sub