I've been looking into the SaveFileDialog and OpenFileDialog features, but have been failing to implement them. The actualy program that I would be implementing this in is much larger, so alternative methods are welcomed.
I also found this page: http://visualbasic.about.com/od/usin...ppsettings.htm which seems to suggest that VB.Net can just save thing automaticallyCode:Public Class Form1 Public Results(2) As Double Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged Dim A, B, C As Double Double.TryParse(TextBox1.Text, A) Double.TryParse(TextBox2.Text, B) C = A + B Label3.Text = C End Sub Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk Dim FileToSaveAs As String = SaveFileDialog1.FileName Dim objwriter As New System.IO.StreamWriter(FileToSaveAs) For i = 0 To 2 objwriter.WriteLine(Results(i)) Next objwriter.Close() End Sub Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click Results(0) = TextBox1.Text Results(1) = TextBox2.Text Results(2) = Label3.Text SaveFileDialog1.ShowDialog() End Sub Private Sub OpenToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripButton.Click OpenFileDialog1.ShowDialog() TextBox1.Text = Results(0) TextBox2.Text = Results(1) Label3.Text = Results(2) End Sub Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk Dim SavedFile As String = OpenFileDialog1.FileName Dim objreader As New System.IO.StreamReader(SavedFile) For i = 0 To 2 objreader.ReadLine(Results(i)) Next objreader.Close() End Sub End Class
And this thread: http://www.vbforums.com/showthread.p...ht=save+inputs which at the end mentions a "bianary formatter".




Reply With Quote