Solved

Saving a Text File in vb 2005

Posted on 2014-10-13
1
164 Views
Last Modified: 2014-10-13
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

0
Comment
Question by:cmdolcet
1 Comment
 
LVL 9

Accepted Solution

by:
dustock earned 500 total points
Comment Utility
Add in before your if statement

SaveFileDialog1.Filter = "Text Files | *.txt"
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now