quinta-feira, 4 de fevereiro de 2010

Ficha 22



Private Type pessoa
codigo As Integer
funcionario As String * 30
salario As Integer
vale As Integer
total As Integer
End Type
Dim tabela(12) As pessoa
Dim i As Integer, w As Integer

Private Sub Command1_Click()
If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Or Text5 = "" Then
MsgBox "Preencha todos os campos"
Else
tabela(i).codigo = Val(Text1.Text)
tabela(i).funcionario = Text2.Text
tabela(i).salario = Val(Text3.Text)
tabela(i).vale = Val(Text4.Text)
tabela(i).total = Val(Text3.Text) + Val(Text4.Text)
Text5.Text = Val(Text3.Text) + Val(Text4.Text)
i = i + 1
w = i
End If
End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
End Sub

Private Sub Command3_Click()
Dim s As Integer
s = MsgBox(" Deseja mesmo sair?", vbYesNo + vbQuestion + vbDefaultButton2, " Pedido de confirmação")
If s = 6 Then
End
End If
End Sub

Private Sub Command4_Click()
If w > 0 Then
w = w - 1
ver_dados (w)
End If
End Sub

Private Sub Command5_Click()
If w < w =" w" text =" tabela(j).funcionario" text =" tabela(j).codigo" text =" tabela(j).salario" text =" tabela(j).vale" text =" tabela(j).total" interval =" 1000" caption = "##/##/####" caption =" Date" caption = "##:##:##" caption =" Time" caption =" Now" caption =" Time" sonumeros =" Key"> 9 Then
If InStr(Numeros$, Chr(Key)) = 0 Then
SoNumeros = 0
End If
End If
End Function

Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = SoNumeros(KeyAscii)
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
KeyAscii = SoNumeros(KeyAscii)
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
KeyAscii = SoNumeros(KeyAscii)
End Sub

terça-feira, 19 de janeiro de 2010


Ficha 20 ex 1

Private Sub Copas_Click()

Picture5.Visible = True

End Sub
Private Sub Espadas_Click()

Picture7.Visible = True

End Sub
Private Sub Ouro_Click()

Picture6.Visible = True

End Sub
Private Sub Paus_Click()

Picture8.Visible = True

End Sub
Private Sub Reinicio_Click()

Picture1.Visible = False

Picture4.Visible = False

Picture5.Visible = False

Picture6.Visible = False

Picture7.Visible = False

Picture8.Visible = False

End Sub
Private Sub Sair_Click()

End

End Sub
Private Sub Smilealegre_Click()

Picture1.Visible = True

End Sub
Private Sub Smiles_Click(Index As Integer)

Picture4.Visible = True

End Sub
Private Sub Smiletriste_Click()

Picture4.Visible = True

End Sub

quinta-feira, 26 de novembro de 2009

Ficha nº15 ex. nº3


Private Sub Command1_Click()
Dim vet(4) As Integer, j As Integer, p As Integer, custo As Single, resultado As Single

MsgBox "Este programa irá pedir que o utilizador introduza 5 preços de 5 artigos e depois o programa irá aumentar o preço de cada um dos produtos em 5%"

custo = 0

For j = 0 To 4
vet(j) = Val(InputBox("Introduza 5 preços de 5 artigos"))
resultado = vet(j) + vet(j) * 0.05
Picture1.Print vet(j);
Picture2.Print resultado;
Next j
End Sub

Private Sub Command2_Click()
Picture1.Cls
Picture2.Cls
End Sub

Private Sub Command3_Click()
End
End Sub

quarta-feira, 25 de novembro de 2009

Ficha15 ex. nº1





Private Sub Command1_Click()
Dim vet(4) As Integer, p As Integer, soma As Integer, peso As Singlesoma = 0
MsgBox "Este programa irá pedir que introduza 5 pesos de 5 pessoas e depois irá fazer a soma e a média dos 5 pesos"

For p = 0 To 4 vet(p) = Val(InputBox("Digite o peso de 5 pessoas"))
Picture1.Print vet(p);
soma = soma + vet(p)
Next p

media = soma / 5
Label3.Caption = soma
Label5.Caption = media

For p = 0 To 4 If vet(p) >= media Then
Picture2.Print vet(p);
End If
Next p
End Sub

Ficha nº15 ex. nº2


Private Sub Command1_Click()
Dim vet(5) As Integer, ampt As Single, j As Single, tempalta As Single, tempbaixa As Single
MsgBox "Este programa irá pedir que introduza os valores de 6 temperaturas à sua escolha e depois o programa irá indicar qual é a temperatura mais baixa e a temperatura mais alta e depois irá indicar a amplitude térmica"

For j = 0 To 5
vet(j) = Val(InputBox("Introduza 6 temperaturas"))
Picture1.Print vet(j);
Next j

tempalta = vet(0)
tempbaixa = vet(0)
For j = 0 To 5If tempalta < tempalta =" vet(j)"> vet(j) Then
tempbaixa = vet(j)
End If
Next j

Label2.Caption = tempalta
Label4.Caption = tempbaixa
ampt = tempalta - tempbaixa
Label6.Caption = ampt
End Sub


Private Sub Command2_Click()
Picture1.Cls
Label2.Caption = ""
Label4.Caption = ""
Label6.Caption = ""
End Sub