Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to clear a Array ?

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

Comments

  • doofusboydoofusboy Posts: 256Member
    : 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.
  • lionblionb Posts: 1,688Member ✭✭
    [b][red]This message was edited by lionb at 2005-12-7 7:16:45[/red][/b][hr]
    : 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
    [code]
    Fot I = 0 to Ubound(MyArray)
    If I = 10 Then
    MyArray(I) = vbNullString
    end if
    Next
    [/code]


  • doofusboydoofusboy Posts: 256Member
    : [b][red]This message was edited by lionb at 2005-12-7 7:16:45[/red][/b][hr]
    : : 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
    : [code]
    : Fot I = 0 to Ubound(MyArray)
    : If I = 10 Then
    : MyArray(I) = vbNullString
    : end if
    : Next
    : [/code]
    :
    :
    :

    Thanks lionb, I had never heard of Erase statement.......learn something new everyday.
  • lionblionb Posts: 1,688Member ✭✭
    :
    : 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.
Sign In or Register to comment.