Results 1 to 2 of 2

Thread: please help!!ASP.NET help with writing array to a file

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    3

    please help!!ASP.NET help with writing array to a file

    someone please help me

    i would like to write the following into a file call shareprice.txt but i keep on getting

    For 10 types of shares for a period from 1 to 365 should become available in a file called shareprice.txt

    i keep only getting the number 365 written on the text??something wrong with my for loop.and how would you generate random numbers across as well??

    the 10 types of share should generate random numbers from 50 to 150
    it should look like this in the file:

    1 25 12 56.....etc (generating random numbers from 50 to 150)
    2
    3
    4
    5
    6
    7
    .
    .
    .
    etc up to 365

    Dim a(365) As Integer
    Dim i As Integer

    For i = 1 To 364

    a(i) = i + 1

    Next


    My.Computer.FileSystem.WriteAllText(path & "SharePrices", a(i) & ControlChars.NewLine, False)

  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: please help!!ASP.NET help with writing array to a file

    That's because when you are doing your WriteAllText, you're giving it a(i). At that point, i = 364.

    You will need to either loop through your array again or generate the 'string' to write to your file in your original for-next 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