26、在窗体中添加一个命令按钮,名称为Command1,然后编写如下程序:
Private Sub Command1_Click()
Dim a(5),b(5)
For j =1 to 4
A(j)=3*j
B(j)=a(j)*3
Next j
Text1.text=b(j\2)
End Sub
程序运行后,单击命令按钮,在文本框中显示( )
A.25 B.18 C.36 D.35
27、在窗体中添加一个命令按钮、一个标签和一个文本框,并将文本框的Text属性置空,编写命令按钮Command1的Click事件代码:
Private Function fun(x As Long) As Boolean
If x Mod 2 = 0 Then
fun = True
Else
fun = False
End If
End Function
Private Sub Command1_Click()
Dim n As Long
n = Val(text1.Text)
p = IIf(fun(n), "奇数", "偶数")
Lable1.Caption = n & "是一个" & p
End Sub
程序运行后,在文本框中输入20,单击命令按钮后,标签中的内容为( )
A.20是一个奇数 B.20 C.20是一个偶数 D.2
28、在窗体中添加一个命令按钮,并编写如下程序:
Public Enum workdays
sunday = 5
monday
tuesday
wednesday
thursday
friday
saturday
invalid = -1
End Enum
Private Sub Command1_Click()
Dim day As workdays
……
End Sub
程序运行后,单击命令按钮,要使程序的运行结果为10,则程序省略处的程序段应为( )
A.day =Friday B、day =Friday
Print day Print Val(day)
C.Workdays =Friday D.Workdays =Friday
Print Val(workdays) Print workdays