Page 2 of 2 FirstFirst 12
Results 41 to 54 of 54

Thread: Split by Line

  1. #41
    Addicted Member
    Join Date
    May 2007
    Posts
    212

    Re: Split by Line

    yea, but i dont have se or sw or ne ANYWHERE in my posts

  2. #42
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Split by Line

    Did you try to read this?

    The pattern searches for something in brackets, and ending with either nw, se, sw, ne. Not sure if they are constant, directions, or some tech lingo that could change... beats me... so if they are not directions, feel free to harp on me for my tech stupidity... if they are always nw, then just remove the other options in the pattern

  3. #43
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Split by Line

    Quote Originally Posted by ethanhayon
    then what would i do with the arrayList?
    StringArray(0) is your first line.
    StringArray(1) is your second line.
    Etc., through (the upper bound of StringArray) - 1, which is your last line.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  4. #44
    Addicted Member
    Join Date
    May 2007
    Posts
    212

    Re: Split by Line

    The code is telling me that peek is not declared, how would i do this

  5. #45
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Split by Line

    NPassero just mistakenly left out a "." in there.

    .Peek

    http://msdn2.microsoft.com/en-us/lib...ek(vs.80).aspx

  6. #46

    Thread Starter
    Hyperactive Member NPassero's Avatar
    Join Date
    May 2007
    Location
    NJ
    Posts
    272

    Re: Split by Line

    Quote Originally Posted by nmadd
    NPassero just mistakenly left out a "." in there.

    .Peek
    sorry about that.
    but i did it on purpose.

  7. #47
    Addicted Member
    Join Date
    May 2007
    Posts
    212

    Re: Split by Line

    its also telling me that add is not a member of system.array

  8. #48
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Split by Line

    If you are speaking of NP's code,
    he wrote ArrayList, not Array.

  9. #49
    Addicted Member
    Join Date
    May 2007
    Posts
    212

    Re: Split by Line

    its giving me an error here:
    Code:
    StringArray.Add(.ReadLine)
    thats where its telling me that add is not a member f system.array

  10. #50
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Split by Line

    I see that there has been a little misstake in the declaration of the arraylist:

    VB Code:
    1. Dim StringArray() as New ArrayList

    this will create an array of arraylists, and i belive thats not what you want right?

    Just remove the ():

    VB Code:
    1. Dim StringArray as New ArrayList
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  11. #51
    Addicted Member
    Join Date
    May 2007
    Posts
    212

    Re: Split by Line

    Name:  strarrayprob.jpg
Views: 111
Size:  139.6 KB

    The attached image is the error that i am getting. There is clearly more than one line in the text file, it only works when i do line (0)

    Any Ideas?

  12. #52
    Addicted Member
    Join Date
    May 2007
    Posts
    212

    Re: Split by Line

    Name:  error.jpg
Views: 98
Size:  37.0 KB

    sorry, i forgot to attach the error

  13. #53
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Split by Line

    You have to put that messagebox after the loop. Imagine the first iteration in the loop, one line has only been added to the ArrayList, yet you try to show the second line, index will always be out of range then.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  14. #54

    Thread Starter
    Hyperactive Member NPassero's Avatar
    Join Date
    May 2007
    Location
    NJ
    Posts
    272

    Re: Split by Line

    An array is zero based meaning that it starts at 0 and then continues from there. So when you add that first item it goes into the slot StringArray(0) not StringArray(1), which is still empty because it has not been filled yet. Hope that clears it up a little bit.

Page 2 of 2 FirstFirst 12

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