1.
Código:
Private Type Cliente
Número As Integer
Total_filmes As Integer
End Type
Dim tabela(1000) As Cliente, i As Integer, j As Integer, total_c As Integer, total_r As Single
Private Sub Command1_Click()
If Text1.Text <> "" And Text2.Text <> "" Then
MsgBox "O seu dados foram guardados!", vbInformation, "Guardado!"
gravar_dados
total_c = total_c + 1
Label11.Caption = total_c
Command1.Enabled = False
total_r = total_r + Label9.Caption
Label13 = total_r & " €"
Command5.Enabled = True
Command6.Enabled = True
Else
MsgBox "Preencha todos os campos!", vbCritical, "Aviso"
End If
End Sub
Private Sub gravar_dados()
tabela(j).Número = Text1.Text
tabela(j).Total_filmes = Text2.Text
i = j
j = j + 1
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Label5.Caption = ""
Label7.Caption = ""
Label9.Caption = ""
Command1.Enabled = True
End Sub
Private Sub Command3_Click()
Form1.Hide
Form2.Show
End Sub
Private Sub Command4_Click()
Dim opcao As Integer
opcao = MsgBox("Deseja sair?", vbQuestion + vbYesNo, "Confirmação")
If opcao = vbYes Then
End
End If
End Sub
Private Sub Command5_Click()
If i > 0 Then
i = i - 1
ver_dados (i)
End If
End Sub
Private Sub ver_dados(x As Integer)
Text1.Text = tabela(i).Número
Text2.Text = tabela(i).Total_filmes
End Sub
Private Sub Command6_Click()
If i < j - 1 Then
i = i + 1
ver_dados (i)
End If
End Sub
Private Sub Form_Load()
i = 0
j = 0
Command1.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
End Sub
Private Sub Text2_Change()
If Text2.Text <> "" Then
Label5.Caption = Text2.Text * 2.5 & " €"
Label7.Caption = Label5.Caption * 0.1 & " €"
Label9.Caption = Label5.Caption - Label7.Caption & " €"
End If
End Sub
Sem comentários:
Enviar um comentário