In my project, I have a multiline textbox (txtInput) in
the main form and the user inputs a list of strings. Then I have to copy the input data into an array of strings (StrArray) So I did this:
But in the textbox2, I saw one special char in each stringVB Code:
StrArray = txtInput.Text.Split(vbCr) For i = 0 To StrArray.GetUpperBound(0) StrArray(i).Trim(vbCr) 'I trid StrArray(i).Replace(vbcr,"") also. 'I tried to trim/replace vbcr,vbnewline and vblf ' to see the results TextBox2.text &= strarray(i) Next
except in the first string. I copied that special char and
pasted in notepad. That char is something like an 'enter key'
How can I remove it?
I tried this also
Now it works fine. I want to know whether there is any methodVB Code:
StrArray = txtInput.Text.Split(vbCr) For i = 0 To StrArray.GetUpperBound(0) ListBox1.Items.Add(StrArray(i).Replace(vbLf, "")) Next ListBox1.Items.CopyTo(StrArray, 0)
to do this without using listbox.




Reply With Quote