求救!!!VB题!!!

来源:百度知道 编辑:UC知道 时间:2024/06/03 16:36:29
设计一个字符大小写转换程序。当在文本框Text1中输入大写字母,在文本框Text2中同时显示其小写字母;当在文本框Text1中输入小写字母,在文本框Text2中同时显示其大写字母;当输入其它字符,则在文本框Text2中原样输出。
使用Lcase和Ucase函数
选择控制结构

以下语句(事件)就是了,对象名称都是默认的

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 65 And KeyAscii <= 90 Then
Text2.Text = Text2.Text & LCase(Chr$(KeyAscii))
ElseIf KeyAscii >= 97 And KeyAscii <= 122 Then
Text2.Text = Text2.Text & UCase(Chr$(KeyAscii))
Else
Text2.Text = Text2.Text & Chr$(KeyAscii)
End If
End Sub