Hello
I am working through a tutorial written in vb.net 2010 . I am using 2010 professional. The tutorial calls for the use of .endofstream , I get an error message (Error 1 'endofstream' is not a member of 'System.IO.StringReader'.
The best I can do is readtoend which generates a run time error conversion from string "map1.map" to type boolean is not valid
I have two questions 1)why don't I have endofstream? 2) how do I make the do until loop work correctly?
Thanks
George
I am working through a tutorial written in vb.net 2010 . I am using 2010 professional. The tutorial calls for the use of .endofstream , I get an error message (Error 1 'endofstream' is not a member of 'System.IO.StringReader'.
Code:
Private Sub loadmap(ByVal mapfile As String)
Try
Dim sr As New IO.StringReader(mapfile & ".map")
Dim strline As String = ""
Dim x As Integer = 0
Dim y As Integer = 0
Do Until sr.endofstream
strline = sr.ReadLine
strline = strline.Replace(strline.LastIndexOf(","), "")
For Each item As String In Split(strline, ",", -1)
If item = "" Then
item = 0
End If
If x <= mapwidth Then
map(x, y, 0) = Int(item)
End If
x += 1
Next
x = 0
y += 1
Loop
sr.Close()
sr.Dispose()
Catch ex As Exception
MsgBox("map '" & mapfile & "' could not be loaded." & vbCrLf & ex.Message, MsgBoxStyle.Critical, "error")
End Try
End Sub
I have two questions 1)why don't I have endofstream? 2) how do I make the do until loop work correctly?
Thanks
George