Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Saving a Text File in vb 2005

Posted on 2014-10-13
1
Medium Priority
?
175 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 2000 total points
ID: 40376967
Add in before your if statement

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

971 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