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 - frmPassword.frm

frmPassword.frm

Caricato da: Roberto VB
Scarica il programma completo

  1. Option Explicit
  2.  
  3.  
  4.  
  5. Private Sub chkPass_Click()
  6.     Dim a As Integer
  7.     a = FreeFile
  8. 'INIZIO PROCEDIMENTO PER GESTIRE LA CHECKBOX
  9.    
  10.     Open App.Path & "\VerPass.dat" For Random As a
  11.     If chkPass.Value = 1 Then
  12.             Put a, 1, "1"
  13.     Else
  14.             Put a, 1, "0"
  15.     End If
  16.     Close a
  17. 'FINE PROCEDIMENTO PER GESTIRE LA CHECKBOX
  18. End Sub
  19.  
  20. Private Sub cmdIndietro_Click()
  21.     Unload Me
  22. End Sub
  23.  
  24. Private Sub cmdOK_Click()
  25. On Error GoTo errore
  26. 'INIZIO PROCEDIMENTO DI INSERIMENTO PASSWORD
  27.     'Apro il file dove c'è la password
  28.     Dim a As Integer
  29.     a = FreeFile
  30.    
  31.     'Se tutte le caselle di testo sono vuote
  32.     'si presume che l'utente abbia aperto la finestra
  33.     'solo per cambiare il segno di spunta
  34.     'quindi:--------------------------------
  35.     If txtVecchiaPass.Text = "" And txtNuovaPass.Text = "" And txtRipetiPass.Text = "" Then
  36.         Unload Me
  37.         Exit Sub
  38.     End If
  39.     '-------------------------------------
  40.     Open App.Path & "\pass.dat" For Random As a
  41.         Get a, 1, Password
  42.         'Se la casella di testo txtVecchiaPass è uguale
  43.         'al valore di default cioè 0000 OPPURE
  44.         'al valore contenuto nel file,
  45.         'E SE le ultime due caselle di testo sono identiche
  46.         'allora tutto OK, scrivo la nuova password
  47.         If txtVecchiaPass.Text = Password Then
  48.             If txtNuovaPass.Text = txtRipetiPass.Text Then
  49.                 Password = txtNuovaPass.Text
  50.                 Put a, 1, Password
  51.                 MsgBox "Password modificata con successo", , "Password"
  52.             End If
  53.         Else
  54.             MsgBox "Si è verificato un errore, controlla di aver inserito" & _
  55.                     " i dati correttamente.", vbExclamation, "ERRORE"
  56.         End If
  57.     Close a
  58. 'FINE PROCEDIMENTO DI INSERIMENTO PASSWORD
  59.    
  60.     Unload Me
  61.     Exit Sub
  62. errore:
  63.     MsgBox Err.Description
  64. End Sub
  65.  
  66. Private Sub Form_Load()
  67.     Dim a As Integer
  68.     Dim Valore As String
  69.     a = FreeFile
  70.     'Verifico se la checkbox deve essere spuntata o meno
  71.     Open App.Path & "\VerPass.dat" For Random As a
  72.         Get a, 1, Valore
  73.             If Valore = "1" Then
  74.                 chkPass.Value = vbChecked
  75.             End If
  76.     Close a
  77. End Sub