首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
窗体上有1个名称为Command1的命令按钮;1个名称为List1、没有列表项的列表框。编写如下程序: Private Sub Command1_Click() Dim x As String, s As String, temp As String
窗体上有1个名称为Command1的命令按钮;1个名称为List1、没有列表项的列表框。编写如下程序: Private Sub Command1_Click() Dim x As String, s As String, temp As String
admin
2020-02-27
18
问题
窗体上有1个名称为Command1的命令按钮;1个名称为List1、没有列表项的列表框。编写如下程序:
Private Sub Command1_Click()
Dim x As String, s As String, temp As String
Dim i As Integer
x = InputBox("输入字符串", "输入")
If x <> "" Then
For i = Len(x) To 1 Step -1
s = Mid(x, i, 1)
If s <> " " Then
temp = s + temp
Else
List1.AddItem temp
s = ""
temp = ""
End If
Next
List1.AddItem temp
Else
MsgBox "输入内容为空!"
End If
End Sub
程序运行后,单击命令按钮Command1,并输入"Happy new year",则在List1中显示的内容为
选项
A、year
new
Happy
B、 Happy
new
year
C、raey
wen
yppaH
D、yppaH
wen
raey
答案
A
解析
List1.AddItem可以为列表框添加列表项。For循环中通过Mid函数从字串中倒序取出字符,碰到空格时添加新列表项。选A)。
转载请注明原文地址:https://kaotiyun.com/show/1UTp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
编写如下程序代码:OptionExplicitPrivateSubForm—Click()DimxAsVariantDimiAsVariantx=Array(50,27,69,80,45)
在数据管理技术发展的三个阶段中,数据共享最好的是()。
(1)在名称为Forml的窗体上添加一个名称为Shapel的形状控件,要求在属性窗口中将其形状设置为椭圆,其短轴(垂直方向)、长轴(水平方向)的长度分别为800、1600。把窗体的标题改为“Shape控件”,窗体上无最大化、最小化按钮。程序运行后的窗体如图
(1)在名称为Forml、标题为“输入”、最大化按钮失效的窗体上画一个名称为I,abell的标签控件,其标题为“输入密码”;再向窗体内画一个名称为Textl的文本框控件,并清空其中的文本。程序执行时,用户在文本框中最多可输入由6个字符组成的密码,密码字符在
(1)在名称为Form1的窗体上画两个标签(名称分别为Label1和Labe12,标题分别为“姓名”和“年龄”)、两个文本框(名称分别为Text1和Text2,初始内容均为空)和一个命令按钮(名称为Command1,标题为“显示”)。然后编写命令按钮的Cl
如果要定义一个窗体级变量,定义变量语句的位置应该是
下列与队列结构有关联的是
已知:x=-6y=39则表达式"y\x*Sgn(x)"的值为( )。
用8位无符号二进制数能表示的最大十进制数为
随机试题
肺泡与肺毛细血管血液之间的气体交换是通过哪种结构实现的()
产程的分期及每个产程初产妇和经产妇所需的时间。
嗜异性凝集试验使用的红细胞是A.O型红细胞B.AB型红细胞C.A型红细胞D.B型红细胞E.绵羊红细胞
某孕妇,25岁,妊娠38周,因血压150/100mmHg收入院。检查:一般情况好,下肢水肿(+),宫底高31cm。估计胎儿体重2600g,胎心率136次/分,尿蛋白(+)。请说出该孕妇的初步诊断为( )。
最易并发颅底骨折的颌骨骨折是()
乳房Paget病是指
下列建设用地取得费用中,属于征地补偿费的有()。
潮湿:干燥
富福利指眼下一些地方政府和企业,为了吸引高端人才,争相开出各种优惠条件,如提供房补、半价专用房等。高端人才往往拥有更高的谋生本领,收人方面已经处于社会的中高端或者高端行列,这一让富有者拥有更多福利的政策偏向引发人们质疑。有人认为此举是将大量的公共资源向高端
A、Protectingroadsalongtheshore.B、Buildingonbeacheswithseawalls.C、Addingsandtobeacheswithseawalls.D、Stoppingbuil
最新回复
(
0
)