By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,684 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,684 IT Pros & Developers. It's quick & easy.

text file creation

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Cor
Hi Brent,
The MID function still exist, I would say, take a look for that.
I hope this helps a little bit
Cor
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)

Nov 20 '05 #2

P: n/a
Hi Brent.

Formatting of values and strings is powerful in VB.NET.

Take a look at these topics in MSDN.

String.Format
http://msdn.microsoft.com/library/de.../cpref/html/fr
lrfsystemstringclassformattopic1.asp

Formatting Overview
http://msdn.microsoft.com/library/de.../cpguide/html/
cpconformattingoverview.asp

Regards,
Fergus
Nov 20 '05 #3

P: n/a
* "Brent Burkart" <Br***********@wvmb.com> scripsit:
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.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

P: n/a
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

"Brent Burkart" <Br***********@wvmb.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
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

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.