Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Monday, August 1, 2011

VB-78 : Encryption and Decryption


Write a program in VB for Encryption and Decryption using the simple logic given below :
A <=> 1
B <=> 2
............
...........
Z <=> 26
In a Text Box, user types a message in English. On pressing Encrypt button, program will convert that message into integer form and on pressing Decrypt button , it will convert the integer values into the character (English) pattern.


(A)Program Design :



(B) Property(Controls Used) :
  • 2 Labels
  • 2 Text Boxes (Text1,Text2) for entering the input string and to show the result.
  • One command button "Encrypt"
(C) Attaching Code to the Object :

Dim icounter As Integer
Dim ch As String
Private Sub Command1_Click()
Text2 = ""
For icounter = 1 To Len(Text1)
ch = Mid(Text1, icounter, 1)
ch = UCase(ch)
j = Asc(ch) - 64
Text2 = Text2 & j
Next
End Sub
(D) Output :




(E) Errors :

If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.



      • ====================================================================
        Back to Home   &  VB
    ===========================================================

    No comments: