error with reading text fil into array-test the code please!
Could someone try this out, please!
Okay, save this first section as a text file in your c directory, (call it feed.text ) or wherever-(just ensure you change the corresponding code below) this is the text i'm trying to read into an array.
Text File
FeedA:100:200:400:233:564:10:237200:400:233
FeedB:267:126:548:128:675:16:293:567:89
FeedC:162:654:876:918:727:81:891:75:554
FeedD:576:713:373:187:931:38:918:87:98
FeedE:102:650:896:908:729:813:791:55:87
FeedF:56:313:673:467:731:382:718:43:76
FeedG:12:54:889:978:726:834:892:32:432
FeedH:57:813:333:189:971:34:914:432:87
Next, using vb.net create a new project, select a smart device application (pocket pc platform, windows application) and place this code on your on Form 1.
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Windows Form Designer generated code
Dim sr1 As StreamReader = File.OpenText("C:\feed.text")
Dim arrInfoTemp(9) As String
Dim arr1() As string 'i originally had this line as Dim arr1 as Array,
'but was told to change it to the above
Dim sStr1 As String
Dim iCount As Integer
Dim arrInfoCount As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
arrInfoCount = -10
Do Until sr1.Peek = -1
arrInfoCount += 10
sStr1 = sr1.ReadLine
arr1 = Split(sStr1, ":")
ReDim Preserve arrInfoTemp(arrInfoCount + 10)
For iCount = 0 To 9
arrInfoTemp(arrInfoCount + iCount) = arr1(iCount)
Next
ReDim Preserve arrInfoTemp(arrInfoCount + 9)
Loop
sr1.Close()
arrInfoCount = arrInfoTemp.GetUpperBound(0)
Dim arrInfo((arrInfoCount + 1) / 10 - 1, 10) As String
For iCount = 0 To (arrInfoCount + 1) / 10 - 1
For arrInfoCount = 0 To 9
arrInfo(iCount, arrInfoCount) = arrInfoTemp(iCount * 10 + arrInfoCount)
Next
Next
End Sub
End Class
Then run it. Why is it erroring like this - how do i get it to work??