迷你版VB 6.0

来源:百度知道 编辑:UC知道 时间:2024/06/16 12:16:42
:设计一个字符大小写转换程序,当在文本框TEXT1中输入大写字母,在文本框TEXT2中同时显示小写字母;当在文本框TEXT1中输入小写字母,在文本框TEX2中同时显示大写字母;当输入其他字符,则在文本框TEXT2中原样输出--------------------这道题的程序代码怎么写

Private Sub Text1_Change()
Text2.Text = LCase(Text1.Text)
End Sub

Private Sub Text2_Change()
Text1.Text = UCase(Text2.Text)
End Sub

Private Sub Text1_Change()
Text2 = UCase(Text1)
End Sub
ucase是转为大写,lcase转为小写

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 91 And KeyAscii > 64 Then
Text2.Text = Text2.Text & Chr(KeyAscii + 32)
ElseIf KeyAscii < 123 And KeyAscii > 96 Then
Text2.Text = Text2.Text & Chr(KeyAscii - 32)
End If
End Sub