This is my Cogwheel Encryption Method to encrypt and decrypt strings.

Wheel1 is Replace by Wheel2 when Encrypting and Wheel2 is Replace by wheel1 when you are decrypting...

To Encrypt a string, just call the EncryptString function

Text2.Text = EncryptString(Text1.Text)

To Decrypt a string, just call the DecryptString function

Text2.Text = DecryptString(Text1.Text)

This is my First Code Snippet so hope you like it.

Comments
Nice for a first time post Jhai.
Option Explicit

'Valid Characters for Password
Const Wheel1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+=-{}[]:;<>,.?/"
'Replacemet For Wheel1 (Must be same with Wheel1 but make it Random)
Const Wheel2 = "89afi1jg2hbekAwxKBCFlmV=-cZrs3X#GY4.?/5tuOJ%^vyLnWzM{NP}[QR$EIoSpq;<>,T0*()67HUdD&!@_+]:"

Public Function EncryptString(xStr As String) As String
Dim xStrHolder As String
Dim xStrIndex As Integer
Dim i As Integer
For i = 1 To Len(xStr)
   xStrIndex = InStr(Wheel1, Mid(xStr, i, 1))
   If xStrIndex = 0 Then
      MsgBox "Invalid use of character!...", vbExclamation, "Invalid Character"
      Exit Function
   Else
      xStrHolder = xStrHolder & Mid(Wheel2, xStrIndex, 1)
   End If
Next i
EncryptString = xStrHolder
End Function

Public Function DecryptString(xStr As String) As String
Dim xStrHolder As String
Dim xStrIndex As Integer
Dim i As Integer
For i = 1 To Len(xStr)
   xStrIndex = InStr(Wheel2, Mid(xStr, i, 1))
   If xStrIndex = 0 Then
      MsgBox "Invalid use of character!...", vbExclamation, "Invalid Character"
      Exit Function
   Else
      xStrHolder = xStrHolder & Mid(Wheel1, xStrIndex, 1)
   End If
Next i
DecryptString = xStrHolder
End Function

Nice way of manipulating strings. There are some easier ways to encrypt and decrypt though. Nice code as well.

Nice way of manipulating strings. There are some easier ways to encrypt and decrypt though. Nice code as well.

:) Thanks. Hope more will learn from it (Manipulating strings)..

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.