vb题求救啊

来源:百度知道 编辑:UC知道 时间:2024/09/23 15:21:33
设计对输入字符进行装换的程序,要求在文本框内输入一个字符就进行转换结果显示在另一个文本框内。规则:将其中小写字母转换成大写,大写转换成小写,其他非字母转换成*

假设两个文本框是Text1和Text2,则
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii>=65 And KeyAscii<=90 Then
Text2.Text=Text2.Text & Chr(KeyAscii+32)
ElseIf KeyAscii>=97 And KeyAscii<=122 Then
Text2.Text=Text2.Text & Chr(KeyAscii-32)
Else
Text2.Text=Text2.Text & "*"
End If
End Sub

分好少