text file creation

  • Thread starter Thread starter Brent Burkart
  • Start date Start date
B

Brent Burkart

I was hoping that someone could give me an idea of how to create a text file
that will be used for input into another system. The challenge I am facing
is that the text file must be in a format that depends on character
positions. For example, a dollar amount must show in position 43 for a
lenght of 8 including the decimal. It also needs to be zero suppressed
(ZZZZZ.ZZ)

I understand how to create the file, its just the formatting and placement
of the text that is challenging me.

Any ideas?

Thanks
 
Hi Brent,
The MID function still exist, I would say, take a look for that.
I hope this helps a little bit
Cor
 
* "Brent Burkart said:
I was hoping that someone could give me an idea of how to create a text file
that will be used for input into another system. The challenge I am facing
is that the text file must be in a format that depends on character
positions. For example, a dollar amount must show in position 43 for a
lenght of 8 including the decimal. It also needs to be zero suppressed
(ZZZZZ.ZZ)

I understand how to create the file, its just the formatting and placement
of the text that is challenging me.

When using VB.NET's file access methods ('FileOpen', ...), you may want
to have a look at the 'Tab' function.
 
May I suggest an Object Oriented solution? Create a Class that has an
instance variable for each value you want formatted. Then give the class
the behavior of formatting each of its values as needed. Then create
another behavior that prints those values out to a file. Then all you have
to do is MyClass.PrintToFile("somefilename"). If you want to be more
rigorous, create a class for each of the formatted values that holds the
value and the format and override the standard ToString method on the class
to format each one appropriately. That way the knowledge of what the
"correct format" is encapsulated in the class.

Regards,
Gary
 
Back
Top