Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 13

Imports Microsoft.VisualBasic 'fully coded by Ghaith Nizar Sinjab Public Class Form1 Inherits System.Windows.Forms.

Form #Region "global declarations" Private ei As Integer() = New Integer(1000) {} Private e As Char() = New Char(1000) {} Private di As Integer() = New Integer(1000) {} Private d As Char() = New Char(1000) {} Friend WithEvents TabControl1 As System.Windows.Forms.TabControl Friend WithEvents TabPage1 As System.Windows.Forms.TabPage Friend WithEvents TabPage2 As System.Windows.Forms.TabPage Friend WithEvents Label10 As System.Windows.Forms.Label Friend WithEvents Label11 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents RichTextBox2 As System.Windows.Forms.RichTextBox Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents LinkLabel2 As System.Windows.Forms.LinkLabel Friend WithEvents Label14 As System.Windows.Forms.Label Friend WithEvents Label13 As System.Windows.Forms.Label Friend WithEvents Label12 As System.Windows.Forms.Label Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents LinkLabel3 As System.Windows.Forms.LinkLabel Friend WithEvents LinkLabel4 As System.Windows.Forms.LinkLabel Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox Private k As Integer = 3 #End Region #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing)

End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Label2 As System.Windows.Forms.Label <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) Me.RichTextBox1 = New System.Windows.Forms.RichTextBox() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.Button3 = New System.Windows.Forms.Button() Me.Label2 = New System.Windows.Forms.Label() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.TabPage1 = New System.Windows.Forms.TabPage() Me.TabPage2 = New System.Windows.Forms.TabPage() Me.Label10 = New System.Windows.Forms.Label() Me.Label11 = New System.Windows.Forms.Label() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Label1 = New System.Windows.Forms.Label() Me.ComboBox1 = New System.Windows.Forms.ComboBox() Me.RichTextBox2 = New System.Windows.Forms.RichTextBox() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.Label5 = New System.Windows.Forms.Label() Me.Label6 = New System.Windows.Forms.Label() Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() Me.Label7 = New System.Windows.Forms.Label() Me.Label8 = New System.Windows.Forms.Label() Me.Label9 = New System.Windows.Forms.Label() Me.Label12 = New System.Windows.Forms.Label() Me.Label13 = New System.Windows.Forms.Label() Me.Label14 = New System.Windows.Forms.Label() Me.LinkLabel2 = New System.Windows.Forms.LinkLabel() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.LinkLabel3 = New System.Windows.Forms.LinkLabel() Me.LinkLabel4 = New System.Windows.Forms.LinkLabel() Me.PictureBox2 = New System.Windows.Forms.PictureBox() Me.PictureBox3 = New System.Windows.Forms.PictureBox() Me.TabControl1.SuspendLayout() Me.TabPage1.SuspendLayout() Me.TabPage2.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'RichTextBox1 ' Me.RichTextBox1.BackColor = System.Drawing.Color.LemonChiffon

Me.RichTextBox1.Location = New System.Drawing.Point(9, 217) Me.RichTextBox1.MaxLength = 1000 Me.RichTextBox1.Name = "RichTextBox1" Me.RichTextBox1.Size = New System.Drawing.Size(420, 146) Me.RichTextBox1.TabIndex = 2 Me.RichTextBox1.Text = "" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(109, 369) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(63, 20) Me.Button1.TabIndex = 3 Me.Button1.Text = "Encrypt" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(263, 369) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(62, 20) Me.Button2.TabIndex = 5 Me.Button2.Text = "Clear" ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(186, 369) Me.Button3.Name = "Button3" Me.Button3.Size = New System.Drawing.Size(62, 20) Me.Button3.TabIndex = 4 Me.Button3.Text = "Decrypt" ' 'Label2 ' Me.Label2.Location = New System.Drawing.Point(9, 196) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(84, 20) Me.Label2.TabIndex = 8 Me.Label2.Text = "Teks Cipher" Me.Label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft ' 'TabControl1 ' Me.TabControl1.Controls.Add(Me.TabPage1) Me.TabControl1.Controls.Add(Me.TabPage2) Me.TabControl1.Location = New System.Drawing.Point(-3, 2) Me.TabControl1.Name = "TabControl1" Me.TabControl1.SelectedIndex = 0 Me.TabControl1.Size = New System.Drawing.Size(534, 473) Me.TabControl1.TabIndex = 19 ' 'TabPage1 ' Me.TabPage1.Controls.Add(Me.PictureBox3) Me.TabPage1.Controls.Add(Me.PictureBox2) Me.TabPage1.Controls.Add(Me.LinkLabel4) Me.TabPage1.Controls.Add(Me.LinkLabel3) Me.TabPage1.Controls.Add(Me.LinkLabel2) Me.TabPage1.Controls.Add(Me.Label14)

Me.TabPage1.Controls.Add(Me.Label13) Me.TabPage1.Controls.Add(Me.Label12) Me.TabPage1.Controls.Add(Me.Label9) Me.TabPage1.Controls.Add(Me.Label8) Me.TabPage1.Controls.Add(Me.Label7) Me.TabPage1.Controls.Add(Me.LinkLabel1) Me.TabPage1.Controls.Add(Me.Label6) Me.TabPage1.Controls.Add(Me.Label5) Me.TabPage1.Controls.Add(Me.Label4) Me.TabPage1.Controls.Add(Me.Label3) Me.TabPage1.Controls.Add(Me.PictureBox1) Me.TabPage1.Location = New System.Drawing.Point(4, 22) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) Me.TabPage1.Size = New System.Drawing.Size(526, 447) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = "tentang kami" Me.TabPage1.UseVisualStyleBackColor = True ' 'TabPage2 ' Me.TabPage2.Controls.Add(Me.Label10) Me.TabPage2.Controls.Add(Me.Label11) Me.TabPage2.Controls.Add(Me.TextBox1) Me.TabPage2.Controls.Add(Me.RichTextBox1) Me.TabPage2.Controls.Add(Me.Label2) Me.TabPage2.Controls.Add(Me.Button1) Me.TabPage2.Controls.Add(Me.Label1) Me.TabPage2.Controls.Add(Me.Button2) Me.TabPage2.Controls.Add(Me.Button3) Me.TabPage2.Controls.Add(Me.ComboBox1) Me.TabPage2.Controls.Add(Me.RichTextBox2) Me.TabPage2.Location = New System.Drawing.Point(4, 22) Me.TabPage2.Name = "TabPage2" Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) Me.TabPage2.Size = New System.Drawing.Size(526, 447) Me.TabPage2.TabIndex = 1 Me.TabPage2.Text = "Chaesar Chiper" Me.TabPage2.UseVisualStyleBackColor = True ' 'Label10 ' Me.Label10.Location = New System.Drawing.Point(3, 3) Me.Label10.Name = "Label10" Me.Label10.Size = New System.Drawing.Size(53, 20) Me.Label10.TabIndex = 17 Me.Label10.Text = "Bahasa" Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight ' 'Label11 ' Me.Label11.Location = New System.Drawing.Point(235, 6) Me.Label11.Name = "Label11" Me.Label11.Size = New System.Drawing.Size(33, 20) Me.Label11.TabIndex = 18 Me.Label11.Text = "Key" Me.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight '

'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(274, 6) Me.TextBox1.MaxLength = 1 Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(174, 20) Me.TextBox1.TabIndex = 16 ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(9, 27) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(84, 20) Me.Label1.TabIndex = 7 Me.Label1.Text = "Teks biasa" Me.Label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft ' 'ComboBox1 ' Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.ComboBox1.Items.AddRange(New Object() {"English", "Arabic"}) Me.ComboBox1.Location = New System.Drawing.Point(56, 3) Me.ComboBox1.Name = "ComboBox1" Me.ComboBox1.Size = New System.Drawing.Size(173, 21) Me.ComboBox1.TabIndex = 0 ' 'RichTextBox2 ' Me.RichTextBox2.BackColor = System.Drawing.Color.Tan Me.RichTextBox2.Location = New System.Drawing.Point(9, 48) Me.RichTextBox2.MaxLength = 1000 Me.RichTextBox2.Name = "RichTextBox2" Me.RichTextBox2.Size = New System.Drawing.Size(420, 146) Me.RichTextBox2.TabIndex = 1 Me.RichTextBox2.Text = "" ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(164, 3) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(147, 13) Me.Label3.TabIndex = 0 Me.Label3.Text = " " ' 'Label4 ' Me.Label4.AutoSize = True Me.Label4.Location = New System.Drawing.Point(187, 16) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(90, 13) Me.Label4.TabIndex = 1 Me.Label4.Text = "Assalamu'alaikum" ' 'Label5 ' Me.Label5.AutoSize = True Me.Label5.Location = New System.Drawing.Point(41, 48)

Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(366, 13) Me.Label5.TabIndex = 2 Me.Label5.Text = "Ini Program Chaesar Chiper yang mempermudah mempelajari Chaesar Chiper" ' 'Label6 ' Me.Label6.AutoSize = True Me.Label6.Location = New System.Drawing.Point(41, 82) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(120, 13) Me.Label6.TabIndex = 3 Me.Label6.Text = "Di buat Oleh :" ' 'LinkLabel1 ' Me.LinkLabel1.AutoSize = True Me.LinkLabel1.Location = New System.Drawing.Point(177, 82) Me.LinkLabel1.Name = "LinkLabel1" Me.LinkLabel1.Size = New System.Drawing.Size(100, 13) Me.LinkLabel1.TabIndex = 4 Me.LinkLabel1.TabStop = True Me.LinkLabel1.Text = " Ghaith Nizar Sinjab" ' 'Label7 ' Me.Label7.AutoSize = True Me.Label7.Location = New System.Drawing.Point(41, 108) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(119, 13) Me.Label7.TabIndex = 5 Me.Label7.Text = "Di Modivikasi Oleh :" ' 'Label8 ' Me.Label8.AutoSize = True Me.Label8.Location = New System.Drawing.Point(177, 108) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(13, 13) Me.Label8.TabIndex = 6 Me.Label8.Text = "1" ' 'Label9 ' Me.Label9.AutoSize = True Me.Label9.Location = New System.Drawing.Point(335, 108) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(13, 13) Me.Label9.TabIndex = 7 Me.Label9.Text = "2" ' 'Label12 ' Me.Label12.AutoSize = True Me.Label12.Location = New System.Drawing.Point(177, 182) Me.Label12.Name = "Label12" Me.Label12.Size = New System.Drawing.Size(13, 13)

Me.Label12.TabIndex = 8 Me.Label12.Text = "3" ' 'Label13 ' Me.Label13.AutoSize = True Me.Label13.Location = New System.Drawing.Point(335, 182) Me.Label13.Name = "Label13" Me.Label13.Size = New System.Drawing.Size(13, 13) Me.Label13.TabIndex = 9 Me.Label13.Text = "4" ' 'Label14 ' Me.Label14.AutoSize = True Me.Label14.Location = New System.Drawing.Point(177, 261) Me.Label14.Name = "Label14" Me.Label14.Size = New System.Drawing.Size(13, 13) Me.Label14.TabIndex = 10 Me.Label14.Text = "5" ' 'LinkLabel2 ' Me.LinkLabel2.AutoSize = True Me.LinkLabel2.Location = New System.Drawing.Point(196, 108) Me.LinkLabel2.Name = "LinkLabel2" Me.LinkLabel2.Size = New System.Drawing.Size(72, 13) Me.LinkLabel2.TabIndex = 11 Me.LinkLabel2.TabStop = True Me.LinkLabel2.Text = "Maulana Rajif" ' 'PictureBox1 ' Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image) Me.PictureBox1.Location = New System.Drawing.Point(196, 124) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(100, 50) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox1.TabIndex = 12 Me.PictureBox1.TabStop = False ' 'LinkLabel3 ' Me.LinkLabel3.AutoSize = True Me.LinkLabel3.Location = New System.Drawing.Point(199, 182) Me.LinkLabel3.Name = "LinkLabel3" Me.LinkLabel3.Size = New System.Drawing.Size(37, 13) Me.LinkLabel3.TabIndex = 13 Me.LinkLabel3.TabStop = True Me.LinkLabel3.Text = "Sandy" ' 'LinkLabel4 ' Me.LinkLabel4.AutoSize = True Me.LinkLabel4.Location = New System.Drawing.Point(355, 108) Me.LinkLabel4.Name = "LinkLabel4" Me.LinkLabel4.Size = New System.Drawing.Size(56, 13)

Me.LinkLabel4.TabIndex = 14 Me.LinkLabel4.TabStop = True Me.LinkLabel4.Text = "Ade Tama" ' 'PictureBox2 ' Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image) Me.PictureBox2.Location = New System.Drawing.Point(347, 124) Me.PictureBox2.Name = "PictureBox2" Me.PictureBox2.Size = New System.Drawing.Size(100, 50) Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox2.TabIndex = 15 Me.PictureBox2.TabStop = False ' 'PictureBox3 ' Me.PictureBox3.Image = CType(resources.GetObject("PictureBox3.Image"), System.Drawing.Image) Me.PictureBox3.Location = New System.Drawing.Point(199, 198) Me.PictureBox3.Name = "PictureBox3" Me.PictureBox3.Size = New System.Drawing.Size(100, 50) Me.PictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox3.TabIndex = 16 Me.PictureBox3.TabStop = False ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(530, 476) Me.Controls.Add(Me.TabControl1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Chaesar Cipher" Me.TabControl1.ResumeLayout(False) Me.TabPage1.ResumeLayout(False) Me.TabPage1.PerformLayout() Me.TabPage2.ResumeLayout(False) Me.TabPage2.PerformLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region #Region "initializations" Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim key As Integer Try key = Integer.Parse(TextBox1.Text) If (key >= 1 And key <= 9) Then k = key

Else MessageBox.Show("Key must be between 1 and 9", "Error", MessageBoxButtons.OK) TextBox1.Text = "3" End If Catch ex As Exception MessageBox.Show("Key must be between 1 and 9", "Error", MessageBoxButtons.OK) TextBox1.Text = "3" End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.SelectedIndex = -1 RichTextBox2.Text = "" RichTextBox1.Text = "" TextBox1.Text = "3" k = Integer.Parse(TextBox1.Text) Button1.Enabled = False Button3.Enabled = False End Sub Private Sub checkStatusE() If Not (ComboBox1.SelectedIndex = -1) Then If Not (RichTextBox2.Text = "") Then Button1.Enabled = True Else Button1.Enabled = False End If Else Button1.Enabled = False End If End Sub Private Sub checkStatusD() If Not (ComboBox1.SelectedIndex = -1) Then If Not (RichTextBox1.Text = "") Then Button3.Enabled = True Else Button3.Enabled = False End If Else Button3.Enabled = False End If End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged checkStatusE() checkStatusD() checkLan() End Sub Private Sub RichTextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged checkStatusE() End Sub Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged checkStatusD() End Sub Private Sub checkLan() Select Case ComboBox1.SelectedIndex Case 0

RichTextBox1.RightToLeft = RightToLeft.No RichTextBox2.RightToLeft = RightToLeft.No Case 1 RichTextBox1.RightToLeft = RightToLeft.Yes RichTextBox2.RightToLeft = RightToLeft.Yes Case -1 RichTextBox1.RightToLeft = RightToLeft.No RichTextBox2.RightToLeft = RightToLeft.No End Select End Sub #End Region #Region "caeser cipher" Private Function checkEng(ByVal val As Integer) As Boolean Dim i As Integer Dim r As Boolean i=0 r = False While (i < 26 And Not r) If val = 65 + i Then r = True End If i += 1 End While i=0 While (i < 26 And Not r) If val = 97 + i Then r = True End If i += 1 End While Return r End Function Private Function checkAra(ByVal val As Integer) As Boolean Dim i As Integer = 0 Dim r As Boolean = False While (i < 42 And Not r) If val = 1569 + i Then r = True End If i += 1 End While Return r End Function Private Sub eEncrypt() Dim code, i As Integer i=0 While (i < 1000 And Not (ei(i) = 126)) If Not checkEng(ei(i)) Then di(i) = ei(i) Else If ei(i) <= 90 Then code = ei(i) - 65 di(i) = ((code + k) Mod 26) + 65 Else code = ei(i) - 97 di(i) = ((code + k) Mod 26) + 97 End If End If

i += 1 End While di(i) = 126 End Sub Private Sub aEncrypt() Dim code, i As Integer i=0 While (i < 1000 And Not (ei(i) = 126)) If Not checkAra(ei(i)) Then di(i) = ei(i) Else code = ei(i) - 1569 di(i) = ((code + k) Mod 42) + 1569 If (di(i) <= 1600 And di(i) >= 1595) Then di(i) = di(i) + 6 End If End If i += 1 End While di(i) = 126 End Sub Private Sub eDecrypt() Dim code, i As Integer i=0 While (i < 1000 And Not (di(i) = 126)) If Not checkEng(di(i)) Then ei(i) = di(i) Else If di(i) <= 90 Then code = di(i) - 65 ei(i) = ((code + 26 - k) Mod 26) + 65 Else code = di(i) - 97 ei(i) = ((code + 26 - k) Mod 26) + 97 End If End If i += 1 End While ei(i) = 126 End Sub Private Sub aDecrypt() Dim code, i As Integer i=0 While (i < 1000 And Not (di(i) = 126)) If Not checkAra(di(i)) Then ei(i) = di(i) Else code = di(i) - 1569 ei(i) = ((code + 42 - k) Mod 42) + 1569 If (ei(i) <= 1600 And ei(i) >= 1595) Then ei(i) = ei(i) - 6 End If End If i += 1 End While ei(i) = 126 End Sub Private Sub eMapInteger(ByRef arr As Char(), ByRef tar As Integer())

Dim i As Integer i=0 While (i < 1000 And i < arr.Length) tar(i) = AscW(arr(i)) i += 1 End While tar(i) = 126 End Sub Private Sub eMapChar(ByRef arr As Integer(), ByRef tar As Char()) Dim i As Integer i=0 While (Not (arr(i) = 126) And i < 1000) tar(i) = ChrW(arr(i)) i += 1 End While End Sub #End Region #Region "button clicks handling" Private Sub Button1_Click(ByVal sender As System.Object, ByVal ev As System.EventArgs) Handles Button1.Click clearFields() RichTextBox1.Text = "" e = RichTextBox2.Text.ToCharArray Select Case ComboBox1.SelectedIndex Case 0 eMapInteger(RichTextBox2.Text.ToCharArray, ei) eEncrypt() eMapChar(di, d) Case 1 eMapInteger(RichTextBox2.Text.ToCharArray, ei) aEncrypt() eMapChar(di, d) End Select RichTextBox1.Text = d End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal ev As System.EventArgs) Handles Button3.Click clearFields() RichTextBox2.Text = "" d = RichTextBox1.Text.ToCharArray Select Case ComboBox1.SelectedIndex Case 0 eMapInteger(RichTextBox1.Text.ToCharArray, di) eDecrypt() eMapChar(ei, e) Case 1 eMapInteger(RichTextBox1.Text.ToCharArray, di) aDecrypt() eMapChar(ei, e) End Select RichTextBox2.Text = e End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal ev As System.EventArgs) Handles Button2.Click ComboBox1.SelectedIndex = -1 RichTextBox1.Text = "" RichTextBox2.Text = "" clearFields()

End Sub Private Sub clearFields() e = New Char(1000) {} ei = New Integer(1000) {} d = New Char(1000) {} di = New Integer(1000) {} End Sub #End Region Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start("http://www.programmersheaven.com/download/52567/do wnload.aspx") End Sub Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click System.Diagnostics.Process.Start("http://www.facebook.com/anang.nunung.wachid") End Sub Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click End Sub Private Sub LinkLabel3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked System.Diagnostics.Process.Start("http://www.facebook.com/sandy.tkt1?ref=pb") End Sub Private Sub LinkLabel4_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel4.LinkClicked System.Diagnostics.Process.Start("http://www.facebook.com/profile.php? id=100000050878183&ref=nf_fr") End Sub End Class

You might also like