...vb程序设计教程答案,在线等 示在文本框Text2,完成下列程序代码。
发布网友
发布时间:2024-10-23 21:54
我来回答
共1个回答
热心网友
时间:2分钟前
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