Hai experts..
I got 3 textboxes (txtInput, txtOutput, txtNumbers). After we put text in txtInput, it will be split based on "," character. Then the numbers will be produce in txtNumbers based on the line number in the txtOutput. Here is my code:
It's ok if we put short sentence. The actual problem is when I want to put long sentence which produce "hanging text". The numbering not arrange properly with text. For example
when I put "aaaaa, bbbbb" it produce:
1. aaaaa
2. bbbbb
but if I put "aaaaaaaaaaaaaaaaaaaa, bbbbb":
1. aaaaaaaaaaaaaaa
2. aaaaa
bbbbb
the actual output I want is:
1. aaaaaaaaaaaaaaa
aaaaa
2. bbbbb
Hope someone can help.
I got 3 textboxes (txtInput, txtOutput, txtNumbers). After we put text in txtInput, it will be split based on "," character. Then the numbers will be produce in txtNumbers based on the line number in the txtOutput. Here is my code:
Code:
Private Sub Command1_Click()
Dim lines() As String, i As Integer
Dim x As String
lines() = Split(txtInput.Text, ",")
For i = 0 To UBound(lines)
txtNumbers.Text = txtNumbers & (i + 1) & ": " & vbCrLf
txtOutput.Text = txtOutput & lines(i) & vbCrLf
Next
when I put "aaaaa, bbbbb" it produce:
1. aaaaa
2. bbbbb
but if I put "aaaaaaaaaaaaaaaaaaaa, bbbbb":
1. aaaaaaaaaaaaaaa
2. aaaaa
bbbbb
the actual output I want is:
1. aaaaaaaaaaaaaaa
aaaaa
2. bbbbb
Hope someone can help.