Results 1 to 12 of 12

Thread: [RESOLVED] Filling and Killing an Array

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    England
    Posts
    79

    Resolved [RESOLVED] Filling and Killing an Array

    I have a loop which is grabbing information from a txt file. The amount of content that is sucked out varies each time.

    What I need to do is somehow add this content from the loop into an array without knowing how much data is already in the array, so Im guessing maybe use the .Count function?

    Also, I need to know how to empty the entire array, do I have to do a loop to zero out all the slots or can I do it all in one function call?

    Cheers

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Filling and Killing an Array

    You can use Redim Preserve and redeclare your array to a size of one element greater while preserving your values, OR, you could see whether your file's values can simply be .Split() into the array you've declared.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    England
    Posts
    79

    Re: Filling and Killing an Array

    OK, and how about removing all data from it?

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Filling and Killing an Array

    Just a "redim" should do.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Filling and Killing an Array

    Also, look at the Array.Clear() method.

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Filling and Killing an Array

    Array.Clear(blah)
    I don't live here any more.

  7. #7
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Filling and Killing an Array

    Damn you frog
    I don't live here any more.

  8. #8
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Filling and Killing an Array

    Quote Originally Posted by Cyber-Drugs
    OK, and how about removing all data from it?
    array has clear method.

    dim s() as string
    s.clear()

  9. #9
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Filling and Killing an Array

    result of slow connection

  10. #10
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Filling and Killing an Array

    see the Erase statement also, I cant remember what it does exactly
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  11. #11
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Filling and Killing an Array

    Quote Originally Posted by MrPolite
    see the Erase statement also, I cant remember what it does exactly
    It establishes an internet connection, downloads 10 gigabytes of Baywatch wallpaper and launches WMP with 6 hours of David Hasselhoff's greatest hits, and you can't turn it off!

    Erase is bad.
    I don't live here any more.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    England
    Posts
    79

    Re: [RESOLVED] Filling and Killing an Array

    *avoids erase like the plague*

    :|

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