DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How do I fill a 2D array from a text file

  1. #1
    bill Guest

    How do I fill a 2D array from a text file

    Hello out there!

    How do I open and read the contents of a text file and load its contents
    (14 "element" columns, and a ever changing number of rows) into an array??
    All the "elements" of the text file are all different data types...



  2. #2
    Kathleen Dollard-Joeris Guest

    Re: How do I fill a 2D array from a text file


    Is each column always the same data type? I will assume this and give you
    two answers.

    You can create a UDT (User-defined Data Type) with an element that describes
    each column. You can then create a 1-D array of those data types.

    Alternatively, you can create a variant array. You will want to pivot to do
    this because you can only increase the outer dimension. If you have a 100
    rows, you would use

    Redim MyArray (1 to 14, 1 to 100)

    and later

    Redim Preserve MyArray (1 to 14, 1 to 101)

    Reply in the newsgroup so everyone can benefit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center