Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.txt file as class member

Status
Not open for further replies.

JHPeter

Programmer
Apr 17, 2003
8
GB
I would like to create a class member to transport a txt file to and from a Web Service, along with other information relating to the file. Is there an easy way to achieve this? ie classmember = "c:\temp\txtfile.txt" or does it have to be achieved by a more tortuous route.

It's all about you, like black cats in the night

 
What is in the text file that you are trying to send to the webservice?


DotNetDoc
M.C.S.D.
[2thumbsup]
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb

-----------------------------------

If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Will you be storing this text file on the server or do you want to capture the information on the text file?

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
I wish to transport an existing text file from a local client (us) through a web service(host) to numerous remote clients(our customers), so they can print off the invoices addressed to them. I can achieve this by using ftp/wininet.dll but would prefer to incorporate it into our existing data transfer system.

At the moment we transfer data which relates to the invoice to our clients so as they can see how the invoice was constructed, ie. how many hours were worked, parts used etc. etc. using various classes (14 at present) for the data transfer.

Info is stored in xml files on the local client, on the web service for distribution and on the remote clients for thier information.

I would be very grateful for any help in this endevour.
 
How does the Client view the data you send them. Do they have a client application that you have written or is it a web site.

This is why I ask. While it can be done, (transffering Text files ), I think a better an more flexible solution would be to transfer the data only.

The Invoice could be reconstructed on the client either with a Web page or a client app using quite a few different methods (Crystal Reports, PDF , or just using the printing namespace)

Transfering the data through a webservice using XML is what it was designed for.

Let me know your thoughts. I can help either way.

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
I have now got it to work by declaring a class member
Public invFile As String() and the following code:

Dim fileName As String = "path to invoice file"
If File.Exists(fileName) Then

Dim fs As StreamReader
fs = File.OpenText(pif)
Dim f As String()
Dim x As Integer = 0

While fs.Peek <> -1
ReDim Preserve f(x)
f(x) = fs.ReadLine()
x += 1
End While

newInvoiceObject.invFile = f

End if

The newInvoiceObject object is then passed to the Web Service and turned into XML

On the web service I reverse the process and save. It can then be downloaded to our customers by thier using the same process by their application.

Many thanks for help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top