Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to clear a Array ? Posted by gerald_manicka on 7 Dec 2005 at 6:10 AM
Hello,

I am using an string array to store a large text in a for loop. When the control moves to next , i want to clear the array value and store new value.some times the following Error comes.

"un-time error '-2147418113(8000ffff)
scan line index out of range"

Please Help me How to resolve this Problem.

Thanks and Regards,

P.Gerald Manickam

Report
Re: How to clear a Array ? Posted by doofusboy on 7 Dec 2005 at 6:58 AM
: Hello,
:
: I am using an string array to store a large text in a for loop. When the control moves to next , i want to clear the array value and store new value.some times the following Error comes.
:
: "un-time error '-2147418113(8000ffff)
: scan line index out of range"
:
: Please Help me How to resolve this Problem.
:
: Thanks and Regards,
:
: P.Gerald Manickam
:
:
Post some of your code, then it may be easier to help you.
Report
Re: How to clear a Array ? Posted by lionb on 7 Dec 2005 at 7:12 AM
This message was edited by lionb at 2005-12-7 7:16:45

: Hello,
:
: I am using an string array to store a large text in a for loop. When the control moves to next , i want to clear the array value and store new value.some times the following Error comes.
:
: "un-time error '-2147418113(8000ffff)
: scan line index out of range"
:
: Please Help me How to resolve this Problem.
:
: Thanks and Regards,
:
: P.Gerald Manickam
:
:
To clear all elements in Array you can use Erase Statement. See code example here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vastmerasex.asp
To do manipulation with single elements you have to go through the loop and set elements' values to NULL/Empty string. Something like that
Fot I = 0 to Ubound(MyArray)
    If I = 10 Then
       MyArray(I) = vbNullString
    end if 
Next



Report
Re: How to clear a Array ? Posted by doofusboy on 8 Dec 2005 at 6:32 AM
: This message was edited by lionb at 2005-12-7 7:16:45

: : Hello,
: :
: : I am using an string array to store a large text in a for loop. When the control moves to next , i want to clear the array value and store new value.some times the following Error comes.
: :
: : "un-time error '-2147418113(8000ffff)
: : scan line index out of range"
: :
: : Please Help me How to resolve this Problem.
: :
: : Thanks and Regards,
: :
: : P.Gerald Manickam
: :
: :
: To clear all elements in Array you can use Erase Statement. See code example here:
: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vastmerasex.asp
: To do manipulation with single elements you have to go through the loop and set elements' values to NULL/Empty string. Something like that
:
: Fot I = 0 to Ubound(MyArray)
:     If I = 10 Then
:        MyArray(I) = vbNullString
:     end if 
: Next
: 

:
:
:

Thanks lionb, I had never heard of Erase statement.......learn something new everyday.
Report
Re: How to clear a Array ? Posted by lionb on 8 Dec 2005 at 10:53 AM
:
: Thanks lionb, I had never heard of Erase statement.......learn something new everyday.
:
Sure anytime. I learned about it from somebody on PH couple years ago.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.