Private Sub Command1_Click()
Form1.Caption = "大小写字母转换"
Label1.Caption = "输入字符串:"
Label2.Caption = "转换:"
Command1.Caption = "清屏"
Command2.Caption = "结束"
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Text1_KeyPress(Keyascii As Integer)
Dim s As String * 1
Dim L As Integer 'L存放文本框中字符串的长度
L = Len(Text2.Text) '求Text2中字符串的长度
s = Chr$(Keyascii) '将ASCII转换成字符
Select Case s
Case "A" To "Z" '大写转换成小写
s = Chr$(Keyascii + 32)
Case "a" To "z" '小写转换成大写
s = Chr$(Keyascii - 32)
Case Else
s = "*" '其他转换成*
End Select
Text2.Text = Text2.Text & s
End Sub