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

Sem comentários:

Enviar um comentário