Hey i'm having an issue where i can save the data i enter into the program but i cant load it as the load button doesn't seem to function.
I don't get any error messages when this happens so i'm very confused
here is the code for the save and load button:
And the load button:
I don't get any error messages when this happens so i'm very confused
here is the code for the save and load button:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Dim SaveFile As New SaveFileDialog SaveFile.FileName = "" SaveFile.Filter = "Text Files (*.txt)|*.txt" SaveFile.Title = "save" SaveFile.ShowDialog() Try Dim write As New System.IO.StreamWriter(SaveFile.FileName) write.Write(txtname.Text) write.Write(txtcatagory.Text) write.Write(txtlocation.Text) write.Write(txtprice.Text) write.Write(txtorder.Text) write.Write(txtstock.Text) write.Close() Catch ex As Exception End Try End Sub
And the load button:
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click Dim FILE_NAME As String = "G:\stock.txt" Dim objreader As New System.IO.StreamReader(FILE_NAME) txtname.Text = objreader.ReadToEnd txtcatagory.Text = objreader.ReadToEnd txtlocation.Text = objreader.ReadToEnd txtorder.Text = objreader.ReadToEnd txtprice.Text = objreader.ReadToEnd txtstock.Text = objreader.ReadToEnd objreader.Close() End Sub
Last edited by a moderator: