Public Class Form1 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = TextBox1.Text
TextBox2.Text = jiam(s) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String
s = TextBox2.Text
TextBox3.Text = jiem(s)
End Sub
Private Function jiam(ByVal s As String)
Dim s1 As String
s1 = ""
For i = 1 To Len(s)
Dim a As Integer
a = Asc(Mid(s, i, 1))
Select Case a
Case 65 To 85, 97 To 117
s1 = s1 & Chr(a + 5)
Case 86 To 90, 118 To 122
s1 = s1 & Chr(a - 21)
Case Else
s1 = s1 & Chr(a)
End Select
Next
jiam = s1
End Function
Private Function jiem(ByVal s As String)
Dim s1 As String
s1 = ""
For i = 1 To Len(s)
Dim a As Integer
a = Asc(Mid(s, i, 1))
Select Case a
Case 65 To 69, 97 To 101
s1 = s1 & Chr(a + 21)
Case 70 To 90, 102 To 122
s1 = s1 & Chr(a - 5)
Case Else
s1 = s1 & Chr(a)
End Select
Next
jiem = s1
End Function
End Class