首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
91
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
能够存放组合框的所有项目内容的属性是
下列叙述中正确的是()。
在窗体上画一个名称为Commandl的命令按钮,并编写如下程序:OptionBase1PrivateSubCommandl_Click()Dima(4,4)Fori=1To4
设有窗体的FormMouseMove事件过程如下:PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)If
在VB中,函数过程与子程序过程的区别之一是
下列说法中,错误的是
设工程中有Form1、Form2两个窗体,要求单击Form2上的Commandl命令按钮,Form2就可以从屏幕上消失,下面的事件过程中不能实现此功能的是
在考生文件夹中有一个工程文件sjt5.vbp。窗体外观如图3—169所示。运行程序,单击“读数据”按钮,文件中的数据被读入字符串变量中并显示在Labe12标签中。单击“排序”按钮时,对读入的数据从小到大排序,并将排序结果显示在窗体的Labe14控件中。要求
请根据以下各小题的要求设计VisualBasic应用程序(包括界面和代码)。(1)在名称为Form1的窗体上画一个名称为Combol的组合框,其宽度为1200,其类型如图3—188所示(即简单组合框)。要求如下:①请按图中所示,通过属
下面对软件测试描述错误的是()。
随机试题
业务决策
依我国《合同法》的规定,如甲发现自己同乙订立了重大误解的合同,他应当在此日起的一年内向法院申请撤销。()
对麻醉药品和第一类精神药品等特殊管理药品“五双”管理规定不包括
在工程网络计划中,工作的总时差是指在不影响()的前提下,该工作可以利用的机动时间。
根据《票据法》规定,下列各项中,属于支票必须记载事项的有()。
中华人民共和国出入境通行证是由()。
简述运输方式的运作特征
简述教学过程优化的要求以及教师在教学过程中应怎样实施优化?
________是指同类别人声组成的合唱。
下列关于恶意代码的描述中,错误的是()。
最新回复
(
0
)