首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程文件中有一个标准模块,其中定义了如下记录类型 Type Books Name As String * 10 TelNum As String * 20 End Type 在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Com
设在工程文件中有一个标准模块,其中定义了如下记录类型 Type Books Name As String * 10 TelNum As String * 20 End Type 在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Com
admin
2019-03-14
23
问题
设在工程文件中有一个标准模块,其中定义了如下记录类型
Type Books
Name As String * 10
TelNum As String * 20
End Type
在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Command1_Click时,在顺序文件Person.txt中写入一条记录。下列能够完成该操作的事件过程是( )。
选项
A、Private Sub Command1_Click()
Dim B As Books
Open "c:\Person.txt" For Output As #1
B.Name=InputBox("输入姓名")
B.TelNum=InputBox("输入电话号码")
Write #1, B.Name, B.TelNum
Close #1
End Sub
B、Private Sub Command1_Click()
Dim B As Books
Open "c:\Person.txt" For Input As #1
B.Name=InputBox("输入姓名")
B.TelNum=InputBox("输入电话号码")
Print #1, B.Name, B.TelNum
Close #1
End Sub
C、Private Sub Command1_Click()
Dim B As Books
Open "c:\Person.txt" For Output As #1
B.Name=InputBox("输入姓名")
B.TelNum=InputBox("输入电话号码")
Write #1, B
Close #1
End Sub
D、Private Sub Command1_Click()
Open "c:\Person.txt" For Input As #1
Name=InputBox("输入姓名")
TelNum=InputBox("输入电话号码")
Print #1, Name, TelNum
Close #1
End Sub
答案
A
解析
数据文件的写操作分为3步,即打开文件、写入文件和关闭文件。
首先,在顺序文件中打开文件写入数据的打开方式为:Open 文件名 For Output As #文件号。因此B、C选项排除,只看A、D选项。
写入顺序文件Print #语句格式为:Print #文件号,变量名,变量名…,Write语句的的格式与Print语句一样:Write #文件号,变量名,变量名。而记录类型变量不能整体引用,需要指明记录变量中的成员名,格式为:记录变量名.成员名,Books类型变量B成员Name和TelNum赋值和引用应该是B.Name、B.TelNum,因此A选项正确。
转载请注明原文地址:https://kaotiyun.com/show/ObUp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
下列关于通用对话框CommonDialogl的叙述中,错误的是
设有以下过程:PrivateSUbproc(xAsInteger,OptionalYAsInteger)Printx,yEndSub针对此过程,下面正确的过程调用语句是
用来设置文字字体是否斜体的属性是
要求如果x被7除余2,则输出x的值,下列语句中不能实现此功能的语句是
为了使标签控件在显示其内容时不覆盖其背景内容,需进行设置的属性为
使用语句DimA(1To10)AsInteger声明数组A后,以下叙述正确的是()。
以下()对象不能作为容器。
考生文件夹中有工程文件sjt3.vbp。在窗体上有名称为Comb01的组合框,请设置该组合框的属性,使该组合框只能用于选择操作,不能输入文本。窗体上还有两个标题分别为“输入正整数”、“判断”的命令按钮。程序运行时在组合框中选中一项,如图5(A所示,单击“输
在名称为Forml的窗体上画一个名称为CDl的通用对话框,通过属性窗口设置CDl的初始路径为c:\,默认的文件名为None,标题为“保存等级考试”,如图2所示。注意:存盘时必须存放在考生文件夹下,工程文件名为sjtl.vbp,窗体文件名为sjtl.frm。
定义无符号整数类为UInt,下面可以作为类UInt实例化值的是
随机试题
阿托品用于解除消化道痉挛时,常可引起口干、心悸、尿潴留、视力模糊等为氨基苷类抗生素所致的耳毒性反应是药物的
下列关于建设工程项目进度控制的表述,不正确的是()。
固定资产盘亏、丢失损失,为其账面净值扣除责任人赔偿后的余额,应依据以下()证据材料确认。
已知A公司销售当季度收回货款55%,下季度收回货款40%,下下季度收回货款5%,预算年度期初应收账款金额为28万元,其中包括上年第三季度销售的应收账款10万元,第四季度销售的应收账款18万元,则下列说法正确的有()。(不考虑增值税)
在下面有关社会工作专业守则的内容表述中,说明了社会工作者对服务对象的责任的是:( )。
关于尿毒症下述正确的有
设x>0,则微分方程的通解为y=_________.
下面关于命令按钮的叙述中错误的是
Theyweretired,butnotanylessenthusiastic______thataccount.
HowmuchwastheU.S.tradedeficitinJune?
最新回复
(
0
)