Full width home advertisement

Post Page Advertisement [Top]

You can use this function for encrypt or decrypt string... One time it encrypt and another time it decrypt.


Private Function encdec(str As String) As String

Dim a As String, b As Integer, c As String
For i= 1 To len(str)
  a = mid(str, i, 1)
  b = Asc(a) Xor 63 'You can use any number for encrypt from 1 to 255
  c =  c & Chr(b)
Next i
encdec = c
End Function




Example:
Place two Command Button name them: cmdEncrypt , cmdDecrypt
Place a text box and change it property multiline = true
Open code window by double clicking on form. Copy the above code and paste on that windows at last.
Copy the below code and paste on that same window at last...
Run your project.........

Private Sub cmdEncrypt_Click()
  text1.text = endec(text1.text)
End Sub

Private Sub cmdDecrypt_Click()
  text1.text= encdec(text1.text)
End Sub


No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib