Link to home
Start Free TrialLog in
Avatar of cmdolcet
cmdolcetFlag for United States of America

asked on

Saving a Text File in vb 2005

I would like to save a file in the format of a .txt file. My code below saves the file but I always need to go into properties of that file and select the open as. Also when I open the file there is nothing written in the file.... its blank.

Dim Veldata as new Arraylist

If Me.SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim Stream As FileStream = New FileStream(Me.SaveFileDialog1.FileName, FileMode.Create)
            Dim streamWriter As New StreamWriter(Stream)
            saveAs = Me.SaveFileDialog1.FileName

            'add the header information
            streamWriter.WriteLine(Now)
            streamWriter.WriteLine("Collected Data")

For intloop 0 to VelData.Count-1 
 streamWriter.WriteLine(Veldata(intloop)
Next
end if

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dustock
dustock
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial