|
-
May 13th, 2008, 07:59 PM
#1
Thread Starter
New Member
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)
-
May 14th, 2008, 02:05 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|