Results 1 to 6 of 6

Thread: [RESOLVED] [2005] deleting array elements - quick question!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    734

    Resolved [RESOLVED] [2005] deleting array elements - quick question!

    I have an array and was wondering whether it was possible to go through the array and delete all the elements that are equal to NULL? If not the would it be possible to do it if i used a List(of T) instead of an array?

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005] deleting array elements - quick question!

    You can't delete items from the Array, once you initialize the array you can't change the size except with the "Redim" operator which will delete all values not just the null ones
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    734

    Re: [2005] deleting array elements - quick question!

    So would you suggest using a list(of T) instead then? Or is there some other way to achieve what i want?

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005] deleting array elements - quick question!

    List(Of T) is a good method, but it all depends on what do you want to do!!
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    734

    Re: [2005] deleting array elements - quick question!

    I have a thread that is controlled by a timer. This thread downloads an XML file everytime the timer ticks and stores the information from the XML file into an array. Now when the timer ticks and another XML file is downloaded then the elements in the array were being replaced so i created another array to copy all the elements of the first array and then jus kept copying across everytime the timer ticked. But it kept copying all the elements of the first array that had nothing in them so i would get an array which had the following element entries:
    arrayElement(0) = nothing
    arrayElement(1) = something
    arrayElement(2) = nothing
    arrayElement(3) = something
    arrayElement(4) = nothing
    etc.....
    so i needed another way to store it so that i didn't keep getting elements with nothing in them.
    Would this still happen if i use list(of T)?

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005] deleting array elements - quick question!

    If you use lists, you can add and remove items easily
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

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