Public Class Form2
Private Sub btnDeskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeskripsi.Click
Dim deskrip, output, inputan As String
Dim panjang_input, pesan As String
Dim i As Integer
If txtInput.Text = "" Then
MessageBox.Show("Tidak ada data inputan", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call hapus()
ElseIf txtInput.Text <> "" Then
inputan = txtInput.Text
panjang_input = Len(txtInput.Text)
For i = 1 To panjang_input
deskrip = Mid(inputan, i, 1)
deskrip = Asc(deskrip)
deskrip = (deskrip - 20) + 43 ' invert key enkripsi
deskrip = Chr(deskrip)
output = output & deskrip
Next i
txtOutput.Text = output
btnEnkripsi.Enabled = False
End If
End Sub
Private Sub btnEnkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnkripsi.Click
Dim Enkrip, output, inputan As String
Dim panjang_input As String
Dim i As Integer
If txtInput.Text = "" Then
MessageBox.Show("Tidak ada data inputan", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call hapus()
ElseIf txtInput.Text <> "" Then
inputan = txtInput.Text
panjang_input = Len(txtInput.Text)
For i = 1 To panjang_input
Enkrip = Mid(inputan, i, 1) ' ambil karakter inputan
Enkrip = Asc(Enkrip) 'ubah karakter ke ascii
Enkrip = (Enkrip + 20) - 43 ' invert key deskripsi
Enkrip = Chr(Enkrip) ' ubah kembali ke karakter
output = output & Enkrip
Next i
txtOutput.Text = output ' tampilkan enkrip
btnDeskripsi.Enabled = False
End If
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Call hapus()
End Sub
Private Sub hapus()
txtInput.Text = ""
txtOutput.Text = ""
btnDeskripsi.Enabled = True
btnEnkripsi.Enabled = True
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtInput.Focus()
End Sub
End Class
Pic aplikasi nya kaya gini
Tidak ada komentar:
Posting Komentar