Private Sub maxlengthword(ByVal str1$, ByRef maxword$)
Dim i%
Dim temp$
i = InStr(str1, " ")
maxword = ""
Do While i > 0
temp = Mid(str1, 1, i - 1)
If Len(temp) > Len(maxword) Then maxword = temp
str1 = Mid(str1, i + 1)
i = InStr(str1, " ")
Loop
If Len(str1) > Len(maxword) Then maxword = str1
TextBox2.Text = maxword
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str1 As String, m As String
m = ""
str1 = TextBox1.Text
maxlengthword(str1, m)
End Sub
无聊
O(∩_∩)O~
这个好像有例子