Results 1 to 5 of 5

Thread: Populating an array from a memo box

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2001
    Posts
    395

    Populating an array from a memo box

    I want to have a control on my form where I can paste in a big list of words, up to 10,000 lines long. Then I want to perform some text manipulation.

    e.g. add/remove " or [] characters to each line. Or add a text phrase to the end of each line.

    I figure the best way to do this would be to read each line into an array.

    What control would be best? Just a text control or is there a memo field like in MS Access vba? How would I read each line into an array? Would reading into an array be the best way to do this?

    Thanks,

    Jon

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Populating an array from a memo box

    a standard textbox control should work fine for you.

    Do you want to read each line into an array? or each word? you will have to split the text on something, like a carrage return.. but line breaks may not match exactly how you see things in the textbox.. because the textbox will wrap a line of text even if its not the end of the line, but the control is smaller than the text for that line (just like notepad does with word wrap)

    so you need to know exacty how you want to split things up.

  3. #3
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Populating an array from a memo box

    If you are using a multiline textbox then you can use the lines property in order to access each line of text in the control. An example of accessing and modifying the lines property for a richtextbox control was posted by me in the below thread:

    http://www.vbforums.com/showthread.php?t=414692

    Of course, you can always use a listbox if you are just making a list of words...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2001
    Posts
    395

    Re: Populating an array from a memo box

    I want to read each line into an array. There will never be more than 5 words in a line so word wrap won't be an issue.

  5. #5
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Populating an array from a memo box

    Then look at the link I posted for an example for the RichTextBox.. its the same for a textbox. Copying the contents to a temp array, modifying the info, and then assigning it back to the lines property...

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