Set up a couple Textboxes, text1, text2
Good for setting up a low security on your programs.
Private Sub Command1_Click()Text2 = Encrypt(Text1)End SubPrivate Sub Command2_Click()Text1 = Decrypt(Text2)End Sub
In a module add this code
Option ExplicitPublic Function Encrypt(ByVal icText As String) As StringDim icLen As IntegerDim icNewText As StringDim icCharicChar = vbNullStringicLen = Len(icText)Dim iFor i = 1 To icLenicChar = Mid$(icText, i, 1)Select Case Asc(icChar)Case 65 To 90icChar = Chr(Asc(icChar) + 127)Case 97 To 122icChar = Chr(Asc(icChar) + 121)Case 48 To 57icChar = Chr(Asc(icChar) + 196)Case 32icChar = Chr(32)End SelecticNewText = icNewText + icCharNext '{End Of}-> For i = 1 To icLenEncrypt = icNewTextEnd FunctionPublic Function Decrypt(ByVal icText As String) As StringDim icLen As IntegerDim icNewText As StringDim icCharicChar = vbNullStringicLen = Len(icText)Dim iFor i = 1 To icLenicChar = Mid$(icText, i, 1)Select Case Asc(icChar)Case 192 To 217icChar = Chr(Asc(icChar) - 127)Case 218 To 243icChar = Chr(Asc(icChar) - 121)Case 244 To 253icChar = Chr(Asc(icChar) - 196)Case 32icChar = Chr(32)End SelecticNewText = icNewText + icCharNext '{End Of}-> For i = 1 To icLenDecrypt = icNewTextEnd Function
No comments:
Post a Comment