StrSplit oddity

Discussion in 'Questions (Windows Mobile)' started by Big JR, May 20, 2007.

  1. Big JR

    Big JR Member Licensed User

    Love StrSplit. Saves me some lines of code and is far more elegant. Having trouble though with the dim statement in Globals. If I use Dim words(0) as string it is fine in a standalone test prog but if I include it in my big and near completed prog I get:
    Error compiling program.
    Error description: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    Occured on line: 5
    Dim words(0) as string

    If I use just Dim words(0) without the 'as string' reference then it is OK.

    Are there any issues if I omit the 'as string'?
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is fine to omit the 'as string' here.
    I don't see any reason why leaving the 'as string' will not work.
    Can you post some of your code or send it to
  3. Erel

    Erel Administrator Staff Member Licensed User

    The problem is here:
    Dim words(0) as string
    Dim string(0) as Byte, secret(0) as Byte, NewArray(0) as Byte

    You are using a variable named string and it causes a confusion.
    Anyway, just omit the 'as string' and it will work fine.
  4. Big JR

    Big JR Member Licensed User

    Many thanks Erel. And they were adjacent lines! I should have seen that. Thanks again.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice