Results 1 to 3 of 3

Thread: [RESOLVED] Create a new line in a .dat file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    Resolved [RESOLVED] Create a new line in a .dat file

    I am trying to save data from some textboxes that I have on a form using this code:

    Code:
    Private Sub AddClientBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddClientBtn.Click
    
            My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "date_" & CalendarBRM.Text, True)
            My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "clientName_" & ClientNameBoxBRM.Text, True)
            My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "policyType_" & PolicyTypeBoxBRM.Text, True)
            My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "annualPremium_" & AnnualPremiumBoxBRM.Text, True)
            My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "agentCsr_" & AgentCsrBoxBRM.Text, True)
    
        End Sub
    It adds the information from the text boxes just fine, but the information is all on the same line. Is there any way to make each one go to a different line?
    Last edited by Boots13; Feb 4th, 2011 at 12:04 PM.

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Create a new line in a .dat file

    If you know up front the values you want to write, you can write them all as per this example in the help files.

    Or you could just append a vbNewLine to the end of each of your data items

    Code:
    My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "date_" & CalendarBRM.Text & vbNewLine, True)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    Re: Create a new line in a .dat file

    Quote Originally Posted by Grimfort View Post
    If you know up front the values you want to write, you can write them all as per this example in the help files.

    Or you could just append a vbNewLine to the end of each of your data items

    Code:
    My.Computer.FileSystem.WriteAllText("G:\Stuff\Lender Ins Files\ProductionReports.dat", "date_" & CalendarBRM.Text & vbNewLine, True)
    Thanks you! I was trying to use vbNewLine but I wasn't sure where to put it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width