this has to do with my last post about the project where it would write to a textfile then read it in the next form. Anyway my teacher is teaching us a certain way and so I managed to make my program almost work. I have 2 problems and would hopefully like it if someone could help me.
1. Right now I have it saving to a specific location, I need it to save to the area which the user specifies in the path textbox on the form.
2. I can get it to retrieve now, but when I click retrieve next it reads the last entry in the textfile. I need it to read line by line until the end. I'll post my new code I hope someone can help.
Code:Option Explicit Private Sub cmdExit_Click() Unload frmMain Unload frmSecond End Sub Private Sub cmdRetrieve_Click() frmSecond.Show frmMain.Hide End Sub Private Sub cmdSave_Click() Dim CurPrice As Currency Dim strTitle As String Dim strArtist As String strTitle = txtTitle.Text strArtist = txtArtist.Text CurPrice = Val(txtPrice) Open "h:\test.txt" For Append As #1 Write #1, strTitle, strArtist, CurPrice txtPrice = Format$(CurPrice, "$##,##0.00") Close #1 txtTitle.Text = "" txtArtist.Text = "" txtPrice.Text = "" End Sub Private Sub Form_Load() End Sub ' this is the first formCode:Private Sub cmdExit_Click() Unload frmMain Unload frmSecond End Sub Private Sub cmdRetrieveNext_Click() Dim strTitle As String Dim strArtist As String Dim CurPrice As Currency Dim int1 As Integer int1 = FreeFile Open "h:\test.txt" For Input As #1 Do While Not EOF(1) Input #1, strTitle, strArtist, CurPrice Loop txtTitle = strTitle txtArtist = strArtist txtPrice = Format$(CurPrice, "$##,##0.00") Close #1 End Sub Private Sub Form_Load() Dim strTitle As String Dim strArtist As String Dim CurPrice As Currency Dim int1 As Integer int1 = FreeFile Open "h:\test.txt" For Input As #1 Input #1, strTitle, strArtist, CurPrice txtTitle = strTitle txtArtist = strArtist txtPrice = Format$(CurPrice, "$##,##0.00") Close #1 End Sub ' this is the 2nd form.




Reply With Quote