CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Writing to sequential text file

    Im having a small problem writing my udt array back to a text file with the comma delimted format, loading the file into the array first time is fine but when i write it back to the file the formatting disappears and the text file is lined up in columns instead of comma delimited.


    Dim intFileNum as Integer

    intFileNum = FreeFile
    Open "a:\vb501\quest1.txt" for Output as intFileNum

    for intPosn = 1 to intTotalRecords
    print #intFileNum, PhoneArray(intPosn).Firstname, _
    PhoneArray(intPosn).LastName, _
    PhoneArray(intPosn).Home, _
    PhoneArray(intPosn).Work, _
    PhoneArray(intPosn).Mobile, _
    PhoneArray(intPosn).Address, _
    PhoneArray(intPosn).Email
    next
    Close intFileNum




    thats the code im using to write the array back to the file in my save function, like i said before it is writing it back without the commas and is lining it all up in columns so next time it doesnt open properly, any help would be appreciated.


  2. #2
    Join Date
    May 1999
    Location
    Memphis
    Posts
    24

    Re: Writing to sequential text file

    try the following :
    PhoneArray(intPosn).Firstname, & "," & _
    PhoneArray(intPosn).LastName, & "," & _
    PhoneArray(intPosn).Home, & "," & _
    PhoneArray(intPosn).Work, & "," & _
    PhoneArray(intPosn).Mobile, & "," & _
    PhoneArray(intPosn).Address, & "," & _
    PhoneArray(intPosn).Email

    EFD

  3. #3
    Guest

    Re: Writing to sequential text file

    Thankyou i needed to remove the commas after the variables to, Thanks again.


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

Featured