Results 1 to 4 of 4

Thread: init. an array?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    269

    init. an array?

    Hi,

    I have a muti-dimension array and would like to init it everytime a form is load?

    do I have to loop through it like below or quicker way to do


    For i=1 to 2000

    array(i).field1 = ""
    array(i).field2 = ""

    next i


    Thanks!

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: init. an array?

    Quote Originally Posted by mapperkids
    Hi,

    I have a muti-dimension array and would like to init it everytime a form is load?

    do I have to loop through it like below or quicker way to do


    For i=1 to 2000

    array(i).field1 = ""
    array(i).field2 = ""

    next i


    Thanks!
    If you use arrays of variable dimension (and the ReDim statement) you can erase them after they've been used.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: init. an array?

    See if this works for you:
    VB Code:
    1. Erase array

  4. #4
    Addicted Member sigid's Avatar
    Join Date
    May 2006
    Location
    Massachusetts, USA
    Posts
    182

    Re: init. an array?

    ...and keep in mind that the array is already initialized during the form load with each cell set to its default value (where strings = "" and numbers = 0)
    If you to initialize it again after the form load, I second SI's suggestion to use ERASE ARRAY (if the array is static) or REDIM ARRAY if it is dynamic...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width