31.新建一个工程,内有两个窗体,窗体Form1上有一个命令按钮Command1,单击该按钮,Form1窗体消失,显示窗体Form2,程序如下: Private Sub Command1_Click() _____ Form2._____ End Sub 试补充完整。 A、UnLoad;Show B、UnLoad Me;Show C、Form1.UnLoad;Form1.Show D、Form1_UnLoad;Form1.Show
A B C D
32.在窗体上画一个命令按钮Command1和两个文本框,名称分别为Text1和Text2,编写如下两个事件过程:____。 Dim str As String,str1 As String Private Sub form_load( ) Text1.Text="" Text2.Text="" Text1.Enabled=False Text2.Enabled=False End Sub Private Sub Form_KeyPress(KeyAscii As Integer) str=str & Chr(KeyAscii) End Sub Private Sub Form_KeyDown(KeyCode As Integer,Shift As Integer) str1=str1 & Chr(KeyCode) End Sub Private Sub Command1_Click( ) Text1.Text=str Text2.Text=str1 str="" str1="" End Sub 当在设计阶段把窗体的KeyPreview属性设置为True时,程序运行运程中,在键盘上输入小写字母xyz,然后单击命令按钮,则 文本框Text1中显示的内容为: A、xyz B、不显示任何信息 C、XYZ D、出错
A B C D
33.在C盘当前文件夹下建立一个名为“Work Data.txt”的顺序文件。要求用InputBox 函数输入5个工人的姓名(WorkName),工资(Workup),工龄(WorkAge)。 Private Sub Form_Click( ) Open "C:WorkData.txt" For output As #1 For i=1 To 5 WorkName=InputBox("请输入姓名") Workp=InputBox("请输入工资") WorkAge=Val(InputBox("请输入年龄")) _____ Next i Close #1 End Sub 供选择的答案如下: A、While Not EOF(1) B、While EOF(1) C、Write #1,WorkName,Workup,WorkAge D、Write #1, "WorkName","Workup","WorkAge"
A B C D
34.对窗体编写如下代码: Option Base 1 Private Sub Form_KeyPress(KeyAscii As Integer) a=Array(237,126,87,48,498) m1=a(1) m2=1 If KeyAscii=13 Then For i=2 To 5 If a(i)>m1 Then m1=a(i) m2=i End If End If Next i End If Print m1 Print m2 End Sub 程序运行后,按回车键,输出结果为____。 A、48 4 B、237 1 C、498 5 D、498 4
A B C D
35.窗体中有一个命令按钮,窗体运行,单击一次命令按钮之后,下列程序代码的执行结果为____。 Public Sub Proc(a() As Integer) Static i As Integer Do a(i) = a(i) + a(i + 1) i = i + 1 Loop While i < 2 End Sub Private Sub Command1_Click() Dim m As Integer, i As Integer, x(10) As Integer For i = 0 To 4: x(i) = i + 1: Next i For i = 0 To 2: Call Proc(x): Next i For i = 0 To 4: Print x(i);: Next i End Sub A、3 4 7 5 6 B、1 2 3 4 5 C、3 5 7 9 5 D、1 2 3 5 7