Writing the contents of an Array to the StreamWriter

1997GAGT
03-20-2004, 10:53 PM
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

Machaira
03-26-2004, 08:26 AM
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?


sCustomers.GetUpperBound = 0

If you're trying to clear the array (not sure why you want to do this) try:

sCustomers = Nothing

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum