Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-04-2009
Member
 
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.
Reply With Quote
  #2  
Old 06-04-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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.
Reply With Quote
  #3  
Old 06-04-2009
Member
 
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)
Reply With Quote
  #4  
Old 06-04-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Array subscript issue in VB 6"
Thread Thread Starter Forum Replies Last Post
Superscript and subscript toggling in powerpoint 2007 Grieg Windows Software 4 28-11-2010 06:49 AM
CAS Array Failover Issue Its_Shaili Windows Software 6 15-08-2010 06:42 AM
Array of array in PHP cyber-noob Software Development 4 26-02-2010 05:13 PM
Assigning an array to an array MACE Software Development 3 18-11-2009 05:19 PM
Excel: error 'subscript out of range' while importing spreadsheet Emma.J Windows Software 3 09-06-2009 07:52 PM


All times are GMT +5.5. The time now is 11:08 AM.