急求vb程序设计教程答案,在线等 示在文本框Text2,完成下列程序代码。

窗体上含有2个文本框(Text1及Text2).一个列表框(List1)和一个命令按钮(command1).程序运行之后,用户在文本框Text1中输入一个字符串,其中包含... 窗体上含有2个文本框(Text1及Text2).一个列表框(List1)和一个命令按钮

(command1).程序运行之后,用户在文本框Text1中输入一个字符串,其中包含若

干个英文单词,单词之间用空格分割。单击命令按钮后,分解出这些单词,并一

次现实在列表框List1中,单词个数显示在文本框Text2,完成下列程序代码。
Private Sub Command1_Clikc()
Dim s As String
s=trim(text1,text)
n=Getword(s)
text2.text=n
End Sub
Function Getword(s As STring) AS Integer
List1.clear
Do While______________________________
P=instr(s,Space(1))
If p=o Then
list.additem s
s=``````
Else
List1.Additem Left(s,p-1)
s=_____________________
End If
Loop
Getwprd=_______________________________
End Function
展开
 我来答
wingay0905
2009-06-09 · TA获得超过208个赞
知道小有建树答主
回答量:220
采纳率:0%
帮助的人:0
展开全部
Private Sub Command1_Click()
Dim s As String
s = Trim(Text1.Text)
n = Getword(s)
Text2.Text = n
End Sub
Function Getword(s As String) As Integer
List1.Clear
Do While s <> ""
p = InStr(s, Space(1))
If p = 0 Then
List1.AddItem s
s = "": Getword = Getword + 1
Else
List1.AddItem Left(s, p - 1)
s = Right(s, Len(s) - p): Getword = Getword + 1
End If
Loop
Getword = Getword
End Function
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式