Click to See Complete Forum and Search --> : Writing to sequential text file


July 4th, 1999, 04:28 AM
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.

deane
July 4th, 1999, 10:09 PM
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

July 5th, 1999, 01:09 AM
Thankyou i needed to remove the commas after the variables to, Thanks again.