Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Bilancio familiare - frmMutuo.frm

frmMutuo.frm

Caricato da: Roberto VB
Scarica il programma completo

  1. Option Explicit
  2.  
  3. Private Sub cmdAzzera_Click()
  4.     txtInteresse.Text = ""
  5.     txtTermine.Text = ""
  6.     txtPagamento.Text = ""
  7.     With txtQuantita
  8.         .Text = ""
  9.         .SetFocus
  10.     End With
  11. End Sub
  12.  
  13. Private Sub cmdCalcola_Click()
  14. On Error GoTo GestioneErrori
  15. 'FORMULA =               Totale * IntMens
  16. '          -------------------------------------------
  17. '          (1 - ( 1 / ( 1 + IntMens )) ^ ( Anni * 12 )
  18.  
  19.     Dim IntMens As Single
  20.     Dim Quantità As Currency
  21.     Dim Numeratore As Currency
  22.     Dim Denominatore As Currency
  23.    
  24.     Dim Percento As Single
  25.     Dim Totale As Currency
  26.     Dim Anni As Integer
  27.     Dim Pagamento As Currency
  28.     'IntMens = Interesse mensile
  29.     Anni = CInt(txtTermine.Text)
  30.     Totale = CCur(txtQuantita.Text)
  31.     Percento = CSng(txtInteresse.Text) / 100
  32.     IntMens = Percento / 12
  33.     Numeratore = Totale * IntMens
  34.     Denominatore = 1 - (1 / (1 + IntMens)) ^ (Anni * 12)
  35.     Pagamento = Numeratore / Denominatore
  36.     txtPagamento.Text = Str(Pagamento)
  37.     Exit Sub
  38. GestioneErrori:
  39.     MsgBox Err.Description, vbExclamation, "ERRORE"
  40.     txtQuantita.SetFocus
  41. End Sub
  42.  
  43. Private Sub cmdEsci_Click()
  44.     Unload Me
  45. End Sub
  46.  
  47. Private Sub Command1_Click()
  48.  
  49. End Sub
  50.  
  51. Private Sub cmdEsporta_Click()
  52.     frmMain.txtMutuo.Text = txtPagamento.Text
  53.     lblEsporta.Caption = "Dato esportato!"
  54. End Sub
  55.  
  56. Private Sub Form_Deactivate()
  57.     lblEsporta.Caption = ""
  58. End Sub