Results 1 to 4 of 4

Thread: Array subscript issue in VB 6

  1. #1
    Join Date
    Mar 2009
    Posts
    89

    Array subscript issue in VB 6

    Hello friends,

    I am facing an issue with my code, whenever i am trying to store any data by splitting a string, I am receiving script out of range error and error in nstr variable.

    Can anyone fix this error for me.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Array subscript issue in VB 6

    Sure i will help you you out with this before that can i get your code, with would be helpful for me to fix your issue.

  3. #3
    Join Date
    Mar 2009
    Posts
    89

    Re: Array subscript issue in VB 6

    Here is the code in which i ma getting the error.

    Code:
    dim mstr() as string
    dim nstr() as string
    dim nstring as string
    
    mstr = Split(nstring, vbctrlf)
    For j = LBound(mstr) To UBound(mstr)
    If nstr(LBound(nstr)) = " " Then
    nstr(UBound(nstr) + 1) = mstr(j)
    Else
    For k = LBound(nstr) To UBound(nstr)

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Array subscript issue in VB 6

    As i can see in the code is that you need to provide a size for the array variable nStr() which you have defined it as undimensioned and to dimension an array on the fly you use the redim statement.

    Use Split() function in Str() array variable. The Split() function automatically dimensions and fills a string array. The lower bound is always 0 when you do this.

Similar Threads

  1. Superscript and subscript toggling in powerpoint 2007
    By Grieg in forum Windows Software
    Replies: 4
    Last Post: 28-11-2010, 06:49 AM
  2. CAS Array Failover Issue
    By Its_Shaili in forum Windows Software
    Replies: 6
    Last Post: 15-08-2010, 06:42 AM
  3. Array of array in PHP
    By cyber-noob in forum Software Development
    Replies: 4
    Last Post: 26-02-2010, 05:13 PM
  4. Assigning an array to an array
    By MACE in forum Software Development
    Replies: 3
    Last Post: 18-11-2009, 05:19 PM
  5. Replies: 3
    Last Post: 09-06-2009, 07:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,700,131.24902 seconds with 17 queries