Can someone tell me why this doesn't work?
Public Sub LoadFile() Dim file As StreamReader Dim temp As String Try file = New StreamReader("C:\file.txt) temp = file.ReadLine() While Not temp Is Nothing Dim ListaTemp() As String = temp.Split(CChar(",")) ListBindingSource.Add(New Mod(CInt(ListTemp(0)), ListTemp(1), ListTemp(2))) temp = file.ReadLine() End While file.Close() Catch ex As Exception MsgBox("Not possible to read file.") Return End Try End Sub
Being that on the Mod class, I have 3 properties (string, double, double) and a list of something.
What I get always that I load this sub (even if the file exists) is the "Not possible to read file." message and it doesn't load to the form field. Since the saving to file function works, what it does is erase the content of the file.
Thank you in advance.