Richard
03-03-2011, 10:56 PM
I know there is a specific VB forum here, but it's possibly collected the most dust out of any subforum.
My issues is that I get a runtime when running the below proc:
Private Sub cmdAddRecipe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddRecipe.Click
Dim objRead As System.IO.StreamReader
Dim i, ii, fileLength As Integer
Dim recipes As String
Dim tempString(1)() As String
Dim items()() As String
objRead = IO.File.OpenText("E:\Computing stuffs\JuiceBar\recipes.txt")
recipes = objRead.ReadToEnd()
While Not objRead.EndOfStream
objRead.ReadLine()
fileLength = fileLength + 1
End While
objRead.Dispose()
objRead.Close()
For i = 0 To fileLength
tempString(0) = Split(recipes, "|")
For ii = 0 To 24
items(i)(ii) = " " '<- this line
tempString(1) = Split(tempString(0)(i), ",")
items(i)(ii) = tempString(1)(i)
Next
Next
End Sub
The runtime states that I can't use the variable "items", as it hasn't been assigned a value. As you can see, I have attempted to assign it a value before it gains the true one, to test the error, but still no.
Ideas?
My issues is that I get a runtime when running the below proc:
Private Sub cmdAddRecipe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddRecipe.Click
Dim objRead As System.IO.StreamReader
Dim i, ii, fileLength As Integer
Dim recipes As String
Dim tempString(1)() As String
Dim items()() As String
objRead = IO.File.OpenText("E:\Computing stuffs\JuiceBar\recipes.txt")
recipes = objRead.ReadToEnd()
While Not objRead.EndOfStream
objRead.ReadLine()
fileLength = fileLength + 1
End While
objRead.Dispose()
objRead.Close()
For i = 0 To fileLength
tempString(0) = Split(recipes, "|")
For ii = 0 To 24
items(i)(ii) = " " '<- this line
tempString(1) = Split(tempString(0)(i), ",")
items(i)(ii) = tempString(1)(i)
Next
Next
End Sub
The runtime states that I can't use the variable "items", as it hasn't been assigned a value. As you can see, I have attempted to assign it a value before it gains the true one, to test the error, but still no.
Ideas?