新建一个工程。在窗体上画一个文本框,名称为Text1。设置用户输入的字母一律转换为大写表示,焦点保持在输入文本的最右端。程序运行结果如图5所示。程序中不得使用任何变量。注意:存盘时必须存放在考生文件夹下,工程文件名为ylcl.vbp,窗体丈件名为ylcl.frm。

题目

新建一个工程。在窗体上画一个文本框,名称为Text1。设置用户输入的字母一律转换为大写表示,焦点保持在输入文本的最右端。程序运行结果如图5所示。程序中不得使用任何变量。

注意:存盘时必须存放在考生文件夹下,工程文件名为ylcl.vbp,窗体丈件名为ylcl.frm。


相似考题
更多“新建一个工程。在窗体上画一个文本框,名称为Text1。设置用户输入的字母一律转换为大写表示,焦点保 ”相关问题
  • 第1题:

    在名为Form1的窗体上放置一个名为Text1的文本框。程序运行后,用户在文本框中输入的英文字母一律用大写显示(要求焦点在最右端),如下图所示。

    注意:

    文件必须存放在考生文件夹中,窗体文件名为execise12.frm,工程文件名为 execise12.vbp。


    正确答案:

  • 第2题:

    在窗体上画一个名称为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"请输入大写字母" KcyCode=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 Or Asc(Text1. Text)<91 Then MsgBox"请输入大写字母" End If End Sub


    正确答案:A
    解析:当在文本框Text1中输入字符时,会激活Text1_KeyPress、Text1_KeyDown和Text1_Change过程,选项C是错误的;KcyDown事件中所得到的KeyCode码(KeyDown事件的参数)65与按字母键“a”是相同的,不能符合题意,选项B是错误的;条件“Asc(Text1.Text)>64OrAsc(Text1.Text)91”满足字母大写的要求,不符合题意,选项D是错误的;选项A是正确的。

  • 第3题:

    在窗体上画一个名称为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

  • 第4题:

    在窗体上画一个名称为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)中判断条件错误,其判断的为输入的是否为大写字母,正好与题目要求相反。

  • 第5题:

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

    A.Private Sub Text1_ KeyPress (KeyAscii As Integer) IfKeyAscii < 65 Or KeyAscii > 9t Then MsgBox “请输入大写字母” End If End sub

    B.Private Sub Text1_ KeyDown (KeyCode As Integer, Shift As Integer) IfKeyCode < 65 Or KeyCode > 91 Then MsgBox “请输入大写字母” End If End sub

    C.Private Sub Text1_ MouseDown (Button As Integer, _ Shift As Integer, X As Single, YAs SinglE)IfAsc (Text1.Text) < 65 Or Asc (Text1. Text) > 91 Then MsgBox “请输入大写字母” End If End sub

    D.Private Sub Text1_ Change() IfAsc(Text 1.Text) < 65 Or Asc(Text1. Text) > 91 Then MsgBox “请输入大写字母” End If End sub


    正确答案:A