(8)窗体上有名称为Command1的命令按钮。事件过程及2个函数过程如下:
Private Sub Command1_Click()
Dim x As Integer,y As Integer,z
x=3
y=5
z=fy(y)
print fx(fx(x)),y
End Sub
Function fx(ByBal a As Integer)
a=a+a
fx=a
End Function
Function fy(ByRef a As Integer)
a=a+a
fy=a
End Function
运行程序,并单击命令按钮,则窗体上显示的2个值依次是 【12】 和 【13】 。
(9)窗体上有名称为Command1的命令按钮及名称为Text1、能显示多行文本的文本框。程序运行后,如果单击命令按钮,则可打开磁盘文件c:\test.txt,并将文件中的内容(多行文本)显示在文本框中。下面是实现此功能的程序,请填空。
Private Sub Command1_Click()
Text1=””
Number=FreeFile
Open “c:\test.txt”For Input As Number
Do While Not Eof( 【14】 )
Line Input #Number,s
Text1.Text=Text1.Text+ 【15】 +Chr(13)+Chr(10)
Loop
Close Number
End Sub
<< 上一页 [11] [12] [13] [14] [15] 下一页