(7)Text文本框接受的最长字符数由文本框的属性确定。
查看答案
(35)在E盘当前目录文件夹下建立一个名为“Student.txt”的随机文件,要求用InputBox函数输入5个学生的姓名(StuName)、年级(StuGrade)和年龄(StuAge).在程序中有下列记录类型和窗体的事件过程,请选择正确的语句完成程序 Private Type student StuName As String*10 StuGrade As String*10 StuAge As String End Type Private Sub For_Click() Dim s As student Open"c:student.txt"For Random As#1 Len=Len(s) For i=1 To 1 s.StuName=InputBox("请输入姓名") s.StuGrade=InputBox("请输入年纪号") s.StuAge=InputBox("请输入年龄") Next i End Sub A.Print#1,s B.Print#1,I C.Put#1,,s D.Put#1,,i
(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