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

Friday, July 1, 2011

VB-28 : Encrypt a given string

Write an event procedure to encrypt a given string.Design an interactive user interface.Use approprite controls.
Assumptions : Encryption Logic is Display Next Character ,That is ,display b for a 


Refer another type of this Program Encryption and Decryption .


(A) Program Design :







(B) Property(Controls Used) :

  • 2 Labels                    :     Captions - Inut and Output) 
  • 2 TextBoxes              :    Delete Text 
  • 2 Command Buttons  :    Captions - Encrypt and Decrypt

(C) Attaching Code to the Object :

Private Sub Command1_Click()
Dim code_str As String
code_str = ""
For i = 1 To Len(Text1.Text)
ch = Mid(Text1.Text, i, 1)
code = Asc(ch) + 1
ch = Chr(code)
code_str = code_str + ch
Next
Text2.Text = code_str
End Sub
Private Sub Command2_Click()
Dim code_str As String
code_str = ""
For i = 1 To Len(Text1.Text)
ch = Mid(Text1.Text, i, 1)
code = Asc(ch) - 1
ch = Chr(code)
code_str = code_str + ch
Next
Text2.Text = code_str
End Sub


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

No comments: