Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Go Back  Xtreme Visual Basic Talk > > > Writing the contents of an Array to the StreamWriter


Reply
 
Thread Tools Display Modes
  #1  
Old 03-20-2004, 10:53 PM
1997GAGT 1997GAGT is offline
Newcomer
 
Join Date: Mar 2004
Posts: 1
Default Writing the contents of an Array to the StreamWriter


Ok so heres my task. Given an Array sCustomers I need to write the statements to create an instance of the streamWriter class and, and write the contents of the array to the Stream writer. Then use the GetUpperBounds method to determine the array size. Heres what I have....Is this right? do I need something more? Please let me know.....
Array sCustomers contains
Name(20 characters)
Address(30 characters)
city(25 Characters)
state(2 Characters)


Private Sub WritingToFile()
Dim fs As New FileStream(E:\vb\names.dat [,FileMode.Append,FileAccess.Write,FileShare.Read])
Dim datNames As New StreamWriter(fs)

For Each sCustomersOne In sCustomers
datNames.WriteLine(sCustomers)
Next sCustomersOne

sCustomers.GetUpperBound = 0
datNames.Close()
End Sub
Reply With Quote
  #2  
Old 03-26-2004, 08:26 AM
Machaira's Avatar
MachairaWriting the contents of an Array to the StreamWriter Machaira is offline
Jedi Coder

* Expert *
 
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
Default

Quote:
Originally Posted by 1997GAGT
Ok so heres my task. Given an Array sCustomers I need to write the statements to create an instance of the streamWriter class and, and write the contents of the array to the Stream writer. Then use the GetUpperBounds method to determine the array size. Heres what I have....Is this right? do I need something more?
Have you tried it?

Quote:
Originally Posted by 1997GAGT
sCustomers.GetUpperBound = 0
If you're trying to clear the array (not sure why you want to do this) try:

sCustomers = Nothing
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to preserve a dynamic multi-dimension array yasermirza General 8 12-17-2003 10:01 AM
Write 2D array to a file Dolptrmn File I/O and Registry 4 11-08-2003 07:42 PM
UDT with variable length strings to Byte Array FreakOZ API 1 07-21-2003 06:04 AM
Help with arrays?? DTFan General 5 07-14-2003 12:01 PM
Casting the contents of a list box as an array of strings brunomik General 3 11-20-2002 07:56 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
 
Writing the contents of an Array to the StreamWriter
Writing the contents of an Array to the StreamWriter
 
-->