To Encrypt The File:
Code:
code = InputBox("Enter Encryption Code", , 1)
If code = "" Then Exit Sub 'if Cancel chosen, exit sub
charsInFile% = Len(txtNote.Text) 'find string length
Open CommonDialog1.FileName For Output As #1 'open file
For i% = 1 To charsInFile% 'for each character in file
letter$ = Mid(txtNote.Text, i%, 1) 'read next char
'convert to number w/ Asc, then use Xor to encrypt
Print #1, Asc(letter$) Xor code; 'and save in file
Next i%
Close #1 'close file when finished
To Decrypt It:
Code:
code = InputBox("Enter encryption code", , 1)
If code = "" Then Exit Sub 'if Cancel chosen, exit sub
Open CommonDialog1.FileName For Input As #1 'open
decrypt$ = "" 'initialize string for decryption
Do Until EOF(1) 'until end of file reached
Input #1, Number& 'read encrypted numbers
e$ = Chr$(Number& Xor code) 'convert with Xor
decrypt$ = decrypt$ & e$ 'and build string
Loop
txtNote.Text = decrypt$
End If
There May Be Some Mistakes But This are the basics.