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
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