vb中在文本框text1中输入的英文字母一律用大写显示的程序怎么写!!!!!

来源:百度知道 编辑:UC知道 时间:2024/07/02 05:34:10
在文本框text1中输入的英文字母一律用大写显示的程序因该怎么写???

Private Sub Text1_Change()
Dim i As Long

i = Text1.SelStart
Text1.Text = UCase$(Text1.Text)
Text1.SelStart = i

End Sub

代码如下。
===================
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 97 And KeyAscii <= 122 Then KeyAscii = KeyAscii - 32
End Sub

Private Sub Text1_Change()
'Text1 = UCase(Text1) '转大写
'Text1 = LCase(Text1) '转小写
End Sub

Text1.Text = UCase str((Text1.Text))或者
text1.text=format(text1.text,">")