首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
窗体上有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
21
问题
窗体上有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://jikaoti.com/ti/qNx0FFFM
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在窗体上画一个名称为Commandl的命令按钮,编写如下程序代码PrivateTvpeStudentsnAsString*10classAsString*20scoreAsDoubleEnd
窗体上有Command1、Command2两个命令按钮。现编写以下程序:OptionBase0Dima()AsInteger,mAsIntegerPrivateSubCommandl_Click()m
窗体上有一个名称为Picturel的图片框控件,一个名称为Labell的标签控件,如图所示。现有如下程序:PublicSubdisplay(xAsContr01)IfTypeOfxIsLabelThenxCap
(1)在考生文件夹下有一个工程文件sjt3.vbp。程序的功能是通过键盘向文本框中输入大、小写字母和数字。单击标题为“统计”的命令按钮,分别统计输入字符串中大写字母、小写字母及数字字符的个数,并将统计结果分别在标签控件数组x中显示,如图所示。在给
如下关于变体类型变量的叙述中,错误的是( )。
以下关于控件数组的叙述中,正确的是( )。
构成计算机软件的是
设栈的顺序存储空间为S(0:49),栈底指针bottom=49,栈顶指针top=30(指向栈顶元素)。则栈中的元素个数为
设工程中有2个窗体:Form1、Form2,Form1为启动窗体。Form2中有菜单,其结构如表。要求在程序运行时,在Form1的文本框Text1中输入口令并按回车键(回车键的ASCⅡ码为13)后,隐藏Form1,显示Form2。若口令为“XSLNCER”
若变量a未事先定义而直接使用(例如:a=0),则变量a的类型是()。
随机试题
内脏包括()。
呋塞米的临床应用包括:
男,55岁。突发左腰部绞痛伴镜下血尿,左侧腹股沟及睾丸疼痛,无肌紧张。应考虑为()
下列关于呼吸链的描述,错误的是
延性破坏是在明显的__________变形后发生的。()
施工组织设计技术经济分析的方法是()。
某市百货公司为增值税一般纳税人,2010年6月发生以下业务:(1)采取买一送一方式销售电视机,共销售150台,每台价格3000元(不含税);同时送出150只电饭煲(市场价格400元/只)(不含税),同时用商场的货车运输,收取送货运费10000元;
根据《关于促进乡村旅游可持续发展的指导意见》,以下对促进乡村旅游可持续发展的基本原则表述正确的是()。
简述中学生自我意识发展的特点。
交警小杨在执勤过程中,拦下一辆超速车。驾驶员请求先将老太太送上火车,再来接受处理。老太太情急之中竟下跪向小杨请求。小杨见状,连忙脱下警帽和大衣,也向老太太跪下,请老太太不要跪了,然后将违章车放行。请你谈谈对此事的看法。
最新回复
(
0
)