首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single
admin
2020-07-22
75
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
strname As String*20
strsex As String*2
smark As Single
End Type
在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Command1_Click时,在C盘根目录下的随机文件Student.dat中写入一条记录。下列能够完成该操作的是( )。
选项
A、Sub Command1_Click()
Dim student As Studtype
Dim record_no As Integer
record_no=1
With student
.ino=12:.strname="smith":
.strsex="男":.smark=89
End With
Open"c:\Student.dat"For Input As #1 Len
=Len(Student)
Put #1,record_no,Student
Close #1
End Sub
B、Sub CommandI_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record no=1
With Student
Ano=12:.strname="smith"
.strsex="男":.smark=89
EndWith
Open"c:\student.dat"ForRandomAs #1
Len=Len(Student)
Put #1,Record no,Student
Close #1
End Sub
C、Private Sub Command1_Click()
Dim Student As Smtype
Dim Record_no As Integer
Record_no=1
With Student
.ino=12:.strname="smith"
.strsex="男":.smark=89
EndWith
Open"c:\student.dat"For Random As 1
Len=Len(Student)
Write #1,Record_no,Student
Close #1
End Sub
D、Sub Command1_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record no=1
With Student
.ino=12:.strname="smith"
.strsex="男":.smark=89
End With
Open"c:\student.dat"For Output AS #1
.Len=Len(Student)
Put #1,Record_no,Student
Close #1
End Sub
答案
B
解析
本题考查文件操作。题目中要求以随机的方式(Random)打开一个文件,打开文件的方法格式为:Open FileName For Random As #文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://kaotiyun.com/show/gcHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在窗体上画一个名称为Text1的文本框和一个名称为Command1的命令按钮,然后编写如下事件过程:PrivateSubCommandl_Click()DimiAsInteger,nAsIntegerFori=
以下不可以作为“容器”的控件是
设窗体上有一个名称为Check1的复选框,并有下面程序代码:PrivateSubCheck1_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
窗体上有1个名称为Text1的文本框;1个名称为Timerl的计时器控件,其Interval属性值为5000,Enabled属性值是True。Timer1的事件过程如下:PrivateSubTimerl_Timer()StaticflagAs
用语句Open”C:\teac.txt”ForInputAs#打开文件后,就可以编程序
设:a=12,b=5,c=7,表达式x=(a\c+aModb)+Int(13/5)的值是
以下关于图片框控件的说法中,错误的是
以下合法的VB变量名是()。
在考生文件夹下有一个工程文件sjt5.vbp。程序运行时,单击“装入数据”按钮,则从考生文件夹下的in5.txt文件中读入所有城市名称和距离,城市名称按顺序添加到列表框List1中,距离放到数组a中;当选中列表框中的一个城市时,它的距离就在Text1中显示
CPU处理数据基本单位为字,一个字的字长()
随机试题
慢性二尖瓣关闭不全最常见的病因是
甲有一幅名画,乙欲购买,甲不想出卖。乙威胁甲说若不卖给他,他便放火烧甲的房子。甲因为害怕不得不将自己名画出售于乙。甲无奈于2006年2月1日将该画以1万元的价格出售于乙。后甲不甘心于2007年1月10日向法院主张撤销合同,并请求返还该画,引起纠纷。下列表述
常年居住在Y省A县的王某早年丧妻,独自一人将两个儿子和一个女儿养大成人。大儿子王甲居住在Y省B县,二儿子王乙居住在Y省C县,女儿王丙居住在w省I题)县。2000年以来,王某的日常生活费用主要来自大儿子王甲每月给的800元生活费。2003年12月,由于物价上
设A为矩阵,都是齐次线性方程组Ax=0的解,则矩阵A为()。
河流排污混合区内污染物迁移转化的主要过程是()。
培训与开发结束时的评估的主要内容是( )。
1903年,我国创办的第一所幼儿教育机构是在()
人们常说“前途是光明的,道路是曲折的”,这句话体现的最主要的辩证法原理是()。
表格中的列控件默认是______。
TheUSCongressA)TheUScongressisthelegislativebranchofthefederalgovernment.Itisabicameral(两院制的)law-making
最新回复
(
0
)