Last post Jun 15, 2009 09:56 PM by naimish
Jun 11, 2009 03:12 PM|WanderingEye|LINK
I'm attempting to use Stringbuilder to write a fixed length text file. However, I can't seem to get the spacing right. Essentially, I need 2 spaces for the first field, 9 for the second, 18 for the third, etc, etc. The point being I need to preserve the
spaces no matter how long the varaible. Any ideas would be greatly appreciated.
Here's what I have thus far:
Dim strBuilder As New StringBuilder(310)
Flat file looks like this:
20 123456789 LEORGE WILLIAMA
Jun 12, 2009 03:01 PM|chintanpshah|LINK
Have you tried to replace spaces with while displaying it as HTML?
Or show it within <em> tag.
Jun 12, 2009 03:02 PM|chintanpshah|LINK
Or show it within <pre> tag.
Jun 15, 2009 05:02 AM|naimish|LINK
It's working fine in console application, please check in your CreateFile Function if it's working fine, if not, please provide code for the same.
Jun 15, 2009 02:16 PM|WanderingEye|LINK
Thanks for the replies. I'm not exactly sure why this method didn't work, but I ended up using the StringBulder.Insert method to build the text file. This allowed me to define the length of each field and apply conversion functions where needed.
Dim strBuilder As New StringBuilder()
Again, thanks for the replies. I appreciate the time and effort.
Jun 15, 2009 09:56 PM|naimish|LINK
The code I have provided it's working fine for me, even your code works fine...Enjoy :)