Fixed With text (characters)

B

Brian Henry

In C++ you could easily create a fixed with string by creating it with
char(50) or so as an example. This made it easy to write data out to a flat
file with a fixed width column. What is the best way in .NET to write to a
fixed width flat file? Being that the data going ot a specific column may or
may not be over or under the specified width. The data must be truncated or
padded to meed the fixed width. Is there any simple way to do this or will I
have to check on each field to see if its over the width then substring it
or under the width and pad it? thanks..
 
H

Herfried K. Wagner [MVP]

Brian Henry said:
In C++ you could easily create a fixed with string by creating it with
char(50) or so as an example. This made it easy to write data out to a
flat file with a fixed width column. What is the best way in .NET to write
to a fixed width flat file? Being that the data going ot a specific column
may or may not be over or under the specified width. The data must be
truncated or padded to meed the fixed width.

See 'VBFixedStringAttribute'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top