Hi Ken,
One way is to create a class whose Property methods only return strings of a
specific length. Then when you write to the file create your lines by
adding these strings together using the properties that only return a set
number of characters. Then write each line to the file. You can create a
WriteFile method in each class and tell it how to write itself. Then you
can create a ReadFile method to tell it how to read a record. On top of
that you can create a collection of your class and have it read in or write
out as many records as you need. Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
"KLomax" <KL****@discuss ions.microsoft. com> wrote in message
news:FD******** *************** ***********@mic rosoft.com...
VB6 allowed you to define User types that you could write to file using
the [Put] statement. This is a nice way to generate fixed length text files.
See Below. VB.NET does not support UserTypes with fixed length strings in the
same way.
How do you do this in VB.NET?
Thanks,
Ken
============
Code Snipit
============
Private Type DAlloc
Code As String * 1
Amount As String * 10
Filler As String * 2
End Type
Dim Debit As DAlloc
Dim i as Integer
Dim iOutFile as Integer
iOutFile = FreeFile
Open msOutFile For Random As #iOutFile Len = Len(Debit)
Debit.Filler = VbCr
For i = 1 To 5
Debit.Code = i
Debit.Amount = CStr(i *2)
Put #iOutFile, , Debit
Next
============