在窗体上画一个名称为Text1的文本框,要求文本框只能接收大写字母的输入。以下能实现该操作的事件过程是

admin2006-08-15  46

问题 在窗体上画一个名称为Text1的文本框,要求文本框只能接收大写字母的输入。以下能实现该操作的事件过程是

选项 A、Private Sub Text1_KeyPress(KeyAscii As Integer)    If KeyAscii < 65 Or KeyAscii > 90 Then      MsgBox "请输入大写字母"      KeyAscii = 0     End If    End Sub
B、Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)    If KeyCode < 65 Or KeyCode > 90 Then      MsgBox "请输入大写字母"      KeyCode = 0     End If    End Sub
C、Private Sub Text1_MouseDown(Button As Integer,_       Shift As Integer, X As Single, Y As Single)    If Asc(Text1.Text) < 65 Or Asc(Text1.Text) > 90 Then       MsgBox "请输入大写字母"     End If    End Sub
D、Private Sub Text1_Change()    If Asc(Text1.Text) > 64 And Asc(Text1.Text) < 91 Then      MsgBox "请输入大写字母"     End If    End Sub

答案A

解析 选项 B)中的大写字母与小写字母的KeyCode相同;选项C)中文本框没有触发MouseDown事件;选项D)中判断条件错误,其判断的为输入的是否为大写字母,正好与题目要求相反。
转载请注明原文地址:https://jikaoti.com/ti/HV80FFFM
0

最新回复(0)