Results 1 to 4 of 4

Thread: [RESOLVED] string problem

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Resolved [RESOLVED] string problem

    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:
    VB Code:
    1. StrArray = txtInput.Text.Split(vbCr)
    2. For i = 0 To StrArray.GetUpperBound(0)
    3.     StrArray(i).Trim(vbCr)
    4.     'I trid StrArray(i).Replace(vbcr,"") also.
    5.     'I tried to trim/replace vbcr,vbnewline and vblf
    6.  
    7. ' to see the results
    8. TextBox2.text &= strarray(i)
    9. Next
    But in the textbox2, I saw one special char in each string
    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
    VB Code:
    1. StrArray = txtInput.Text.Split(vbCr)
    2. For i = 0 To StrArray.GetUpperBound(0)
    3.     ListBox1.Items.Add(StrArray(i).Replace(vbLf, ""))
    4. Next
    5. ListBox1.Items.CopyTo(StrArray, 0)
    Now it works fine. I want to know whether there is any method
    to do this without using listbox.
    Last edited by jain_mj; Sep 13th, 2005 at 08:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width