首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single End Type 在窗体上画一个名为Com
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single End Type 在窗体上画一个名为Com
admin
2019-06-20
115
问题
设在工程中有一个标准模块,并定义了如下类型:
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:.stmame="smith"
.strsex="男":.smark=89
End With
Open"c:\Student.dat"For Input As#1Len
=Len(Student)
Put#1,record_no,Student
Close#1
End Sub
B、Sub Command1_Click()
Dim Student As Stutype
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)
Put#1.Record no,Student
Close#1
End Sub
C、Private Sub Command1_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record_no=1
Wim Student
.ino=12:.stmame="smith"
.strsex="男":.smark=89
End Wim
Open"c:\student.dat"For Random As1
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:.stmame="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 File Name For Random As撑文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://kaotiyun.com/show/ffUp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
下面不属于软件工程过程的4种基本活动
在属性窗口中把窗体的KeyPreview属性设置为True,然后编写如下两个事件过程:PrivateSubForm_KeyDown(KeyCodeAsInteger,ShiftAsInteger)PrintChr(KeyC
在窗体上画一个命令按钮(Name属性为Command1),然后编写如下事件过程:PrivateSubCommand1Click()Dima(10)AsInterger,p(3)AsIntergerK=5F
为了在窗体上建立2组单选按钮,并且当程序运行时.每组都可以有一个单选按钮被选中,则以下做法中正确的是()。
执行下面的程序段后,变量S的值为()。S=5Fori=2.6To4.9Step0.6S=S+lNexti
为了使名称为Command1的命令按钮右移200,应使用的语句是()。
设有如下过程:PrivateSubForm_KeyDown(KeyCodeAsInteger,ShiftAsInteger)PrintChr(KeyCode)EndSubPrivateSu
某人编写了下面的程序,希望能把Text1文本框中的内容写到Temp.txt文件中PrivateSubCommand1_Click()Open"Temp.txt"ForOutputAs#2Print"Text1"
假定已在窗体上画了多个控件,其中有一个被选中,为了在属性窗口中设置窗体的属性,预先应执行的操作是
下面的数写成普通十进制数是()。2.65358979335278D-6
随机试题
阅读杜甫《月》,然后回答问题。万里瞿唐①月,春来六上弦②。时时开暗室,故故③满青天。
A.肺部胸片示云雾状浸润B.肺部胸片示纤细条状影伴散在小片状肺泡病变、肺气肿C.肺部胸片示大小不等斑片状密度增深影,右肋膈角不清D.肺部胸片示两下肺大片状阴影E.肺部胸片示肺部有密度均匀、边缘不清片状阴影,同侧肺门有团块状阴影F.肺部胸片示两肺
肠性氮质血症
计算地基变形时如需考虑土的固结状态,下列选用的计算指标中正确的是( )。
施工项目管理规划的编制应由( )负责。
会员制期货交易所的会员应当履行的主要义务有()。
变动成本法与吸收成本法在()方面是一致的。
某工作中你和老同事一块做,你觉得他的处理方法不对,提出来后,老同事一笑了之。你怎么办?
封建制法律的基本特征有()
Whatshouldyoutakeintoconsiderationwhenchoosingalifeinsurancepolicy?Bothyourneedsandthe______.Whowillbenefi
最新回复
(
0
)