Results 1 to 3 of 3

Thread: multidimensional array

  1. #1
    Guest
    I want to create a multidimensional array similar to the IRS Tax Tables where the first column consists of income figures and the other columns (e.g., 5 columns) have corresponding values. Essentially, I want to program an application to look up an income figure in the first column and then get the corresponding value out of one of the other columns. In an Excel spreadsheet, that would be like using VLOOKUP or HLOOKUP.

    I do not want to use a relational database because I do not want the overhead that goes with that; also the values in the table would never change, and there is no need to have the table relational.

    I used to do this with old the BASIC language using READ and DATA statements, but I find no support for these statements in Visual Basic.

    I know how to define (DIM) a multidimensional array, but how do I then actually code the table or array? Since my table values will never change, I want to hardcode the values into the program.

    Unlike the tax tables, there is no algorithm or formula to calculate or define the values in each "cell." I simply need the most efficient way to load or initialize the table. It will be about 300 row by 6 columns.

    Thanks.

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Sorry, but about two months ago I was looking for exactly the same answer you were! I had 3 tables, each 27*34, and all would never change so that I could hard code them.
    Took me a day and a half to type all the values in .
    There is just no other way other than going
    Code:
    myArray(1,1,1) = "hgjhg"
    .....
    myArray(3,27,34) = "kjkjg"
    Oh...how I could have done with the READ...DATA statement.

    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230
    Actually, there is another way. I scanned the tax tables and converted the file using an OCR to delimited text file. You can then read and parse the file as a sequential file and store the values in any size array you wish with a loop.

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