I am having a serious problem where StreamReader will not read the entire file. If I set the path of the save file to the smae place that the executable is in, the StreamReader will read the whole file. If I have the location set to anywhere else, the StreamReader will only read a tiny bit of the file.
Code:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Dim path As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\saves.txt" Dim read As New System.IO.StreamReader(path, True) Dim saves As String = read.ReadToEnd calc = saves.Split("!")(0) cps = saves.Split("!")(1) pquantity = saves.Split("!")(2) pprice = saves.Split("!")(3) fquantity = saves.Split("!")(4) fprice = saves.Split("!")(5) miquantity = saves.Split("!")(6) miprice = saves.Split("!")(7) micquantity = saves.Split("!")(8) micprice = saves.Split("!")(9) piquantity = saves.Split("!")(10) piprice = saves.Split("1")(11) vquantity = saves.Split("!")(12) vprice = saves.Split("!")(13) rquantity = saves.Split("!")(14) rprice = saves.Split("!")(15) lquantity = saves.Split("!")(16) lprice = saves.Split("!")(17) mquantity = saves.Split("!")(18) mprice = saves.Split("!")(19) bquantity = saves.Split("!")(20) bprice = saves.Split("!")(21) read.Close() Catch ex As Exception End Try NumberFormat() End Sub Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Dim path As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\saves.txt" Dim W As New System.IO.StreamWriter(path, True) W.Write(score & "!" & cps & _ "!" & pquantity & "!" & pprice _ & "!" & fquantity & "!" & fprice _ & "!" & miquantity & "!" & miprice _ & "!" & micquantity & "!" & micprice _ & "!" & piquantity & "!" & piprice _ & "!" & vquantity & "!" & vprice _ & "!" & rquantity & "!" & rprice _ & "!" & lquantity & "!" & lprice _ & "!" & mquantity & "!" & mprice _ & "!" & bquantity & "!" & bprice) W.Close() End Sub




Reply With Quote
