+ Post New Thread
Results 1 to 1 of 1
Coding Thread, Subscript error on vb split function in Coding and Web Development; Hi, I have a string that on an asp page that stores the forename, surname and year of a list ...
  1. #1

    Join Date
    Aug 2006
    Location
    Notts
    Posts
    38
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Subscript error on vb split function

    Hi, I have a string that on an asp page that stores the forename, surname and year of a list of pupils; each bit is seperated by an _ and each individual person by a |. For example Bob_smith_7|john_jones_8.

    Using the split function I've seperated each person into an array:
    MyArray(0) = Bob_smith_7
    MyArray(1) = john_jones_8.
    This bit works fine.

    However when I come to split forename, surname and year it up I get a subscript error. The code is basically doing a For Next Loop for Each person in the Array, splitting their details into a second array; MyArray2 = Split(Myarray(i)), and then printing the forename and surname on the page.

    If i do for example:
    response.write MyArray2(0) i get a subscript error.
    However if I do
    ----
    For i = 0 to ubound(MyArray2)
    response.write MyArray2(i)
    Next
    ---
    This works.

    What's causing the error when I try and access an element in the array directly, but doesn't cause the error when being done in a For Next loop?

    Hope this all makes sense, and if you want to see the propper source code view the attached file.

    Many thanks.
    Ryan
    Attached Files Attached Files



SHARE:
+ Post New Thread

Similar Threads

  1. Split a network cable
    By alonebfg in forum Wireless Networks
    Replies: 27
    Last Post: 6th November 2008, 02:13 PM
  2. Split a screen
    By Lithium in forum Windows
    Replies: 6
    Last Post: 3rd December 2007, 10:57 PM
  3. FN + F5 function key does not work
    By alexknight in forum Hardware
    Replies: 8
    Last Post: 7th February 2007, 03:32 PM
  4. Split site Network
    By lee_sri in forum Wireless Networks
    Replies: 8
    Last Post: 2nd February 2006, 08:39 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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