(17)在窗体上有一个文本框,其名称为Text1,编写下列事件过程: Private Sub Text1_KeyPress(KeyAscii As Integer ) Dim str As String Str=Chr(KeyAscii) KeyAscii=Asc(UCase(str)) Text1.Test=String(2,KeyAscii) End Sub 程序运行后,如果在键盘上输入字母“a”则在文本框Text3中显示的内容为 A.aaa B.AAA C.AA D.aa
查看答案
(11)建立一个通讯录的随机文件phonBook.txt,内容包括姓名、电话、地址和邮编,用文本框输入数据。单击“添加主记录”按钮Command1时,将文本框数据写入文件,单击“显示按钮”Command2时,将文本中所有内容显示在立即窗口。Private Type PerDate Name1 As String Phon As String*11 Address As String*10 PostCd As String*6 End Type定义PerData类型的变量xDataPrivate Sub Form_Click() Open"C:\PhonBook.txt"For Random As 1End SubPrivate Sub Command1_Click() xData.Name1=Text1.Text xData.Phon=Text2.Text __________=Text3.Text xData.PostCd=Text4.Text Put#1,1,xData Text1.Text="":Text2.Text="" Text3.Text="":Text4.Text=""End Sub Private Sub Command2_Click() Reno=Lof(1)/Len(xData) i=1 Do While i=reno Get#1,i,xData Debug.Print xData.Name1,______,xData.Address,xData.PostCd i=i+1 LoopEnd Sub
(25)在窗体上有一个命令按钮Commandl,编写下列程序: Private Sub Command1_Click() Print ppl(3,7) End Sub Public Funcion ppl(x As Single,n As Integer)As Single If n=0 Then ppl=1 Else If n Mod 2=1 Then ppl=x*x+n Else ppl=x*x-n End If End If End Funcion 程序运行后,单击该命令按钮,屏幕上显示的是 A.2 B.1 C.0 D.16
(21)语句Dim Arr(-3 To 5)As Integer定义的数组的元素个数是 A.6 B.7 C.8 D.9