Jump to content
Xtreme .Net Talk

mcapone888

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by mcapone888

  1. Public Class frmReadWriteTest Inherits System.Windows.Forms.Form Dim Save1, Save2, Save3 As String Windows Form Designer generated code Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Save1 = txtOne.Text Save2 = txtTwo.Text Save3 = txtThree.Text FileOpen(1, "test.txt", OpenMode.Output) WriteLine(1, Save1, Save2, Save3) FileClose(1) End Sub Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click FileOpen(1, "test.txt", OpenMode.Input) Input(1, Save1) Input(1, Save2) Input(1, Save3) FileClose(1) txtFour.Text = Save1 txtFive.Text = Save2 txtSix.Text = Save3 End Sub End Class
  2. Hi everyone, I am new to VB.net, and have only played around with VB6 as a hobby. I know this is not the best way to write and read from a file, but this is what I used in the past, and it worked great for me. I am trying to write some variables to a simple text file, and then be able to use load them again at a later time. In VB 6 I used: for saving (writing): Open App.Path & "\file.txt" For Output As #1 Write #1, String1, String2, Integer1 Close #1 for loading (reading): Open App.Path & "\file.txt" For Input As #1 Input #1, String1, String2, Integer1 Close #1 This wrote the three variables to a simple text file found in the same location as the startup path of the program. How can I recreate this same simple code for a VB.Net windows application? If possible, please let me know the easiest way to do this, even if it is not the correct or best method possible. Thanks!! Michael
×
×
  • Create New...