CodeItBetter Programming Another VB Programming Blog

How to create simple Text Encoder/Decoder

Posted on July 6, 2010

Here is the simple vb6 function which can encode/decode any simple text:

Instructions:

  • Create a new Project
  • Add a new module to it and name it as Module1

Now, add the following code to Module1:

1
2
3
4
5
6
7
8
9
10
Option Explicit
 
Public Function GetEnCodedDecodedText(ByVal sText As String) As String
    Dim I As Long
    Dim sResult As String
    For I = 1 To Len(sText)
        sResult = sResult & Chr$(255 - Asc(Mid$(sText, I, 1)))
    Next I
    GetEnCodedDecodedText = sResult
End Function

How to call this function:

1
Debug.print GetEnCodedDecodedText("testing")
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

Trackbacks are disabled.