Hi all,

How i can split a sentences into words and add splitted words into listbox.

Thank you.
Best regards

Eko

Recommended Answers

All 4 Replies

See if this help :

Private Sub Command1_Click()
List1.Clear
x = 0
For j = 1 To Len(Trim(Text1.Text))
    kt1 = Mid(Trim(Text1.Text), j, 1)
    kta = kta + kt1
    If kt1 = Chr(32) Then
        x = x + 1
        List1.AddItem Trim(kta)
        kta = ""
    End If
Next j

If x >= 0 Then List1.AddItem Trim(kta)

End Sub
commented: Worked really nice :D +1

How i can split a sentences into words and add splitted words into listbox.

You could try writing some code as is suggested for submitting requests in the guidelines.

But you could use the Mid function as indicated or you could use the Instr function. Search for the space character and declare a variable to return the value returned from your search. You'll use that value to start determine the word and also to determine the start point for the remaining portion of your search.

Thank you all for helps..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.