Results 1 to 3 of 3

Thread: array and reading from file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    24

    array and reading from file

    District 1 District 2 District 3 District 4
    285 251 851 562 name1
    521 423 874 547 name2
    451 362 862 845 name3
    411 562 846 245 name4
    420 285 765 365 name5

    this stuff reads from the file ,except districts names. I want to know how do I put these numbers(district1,2,3,4) columns into one numeric array number? for example I want to add all the numbers in district 1 and display total from that district. I also want to display total number out of all the districts. I want this to be an array.
    Last edited by matase; May 1st, 2008 at 05:07 PM.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: array and reading from file

    Other than reading file line-by-line, splitting numbers into say some temp array and increment some variables you wouldn't have many other options...

    However, if you can substitute text file with database (perhaps MS Access) it could be as simple as executing very basic sql:

    select sum(filed1) where field2 = 'District1'

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    24

    Re: array and reading from file

    there is no way to do that without rearranging the txt file to do that in VB 6.0? I guess I will have to make 4 different variables to get the total of each one.

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