Saving As Filetype Help

insomnica

Member
Joined
Nov 10, 2007
Messages
10
Programming Experience
1-3
Hey Guys!

Need a tad bit of help on my simple wordpad, MattPro.
Im a beginner in all of this, but I can grasp the concepts.

Anywho, im using the basic SaveFile:

VB.NET:
Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
        If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim SW As New IO.StreamWriter(SaveFileDialog1.Filename)
            SW.Write(Textbox1.Text)
            SW.Flush()
            SW.Close()
            FileOpen(1, SaveFileDialog1.Filename, OpenMode.Output)
            Print(1, TextBox1.Text)
            FileClose(1)
        End If
    End Sub

And Id like to know how I can define it to save as a list of preset filetype?
Where the arrow details in my 1337 screenshot:p
http://img161.imageshack.us/img161/5271/filext7.png
 
Check documentation for the SaveFileDialog, Filter property.

You can also add this to your saving code:
VB.NET:
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename, TextBox1.Text, False)
 
Check documentation for the SaveFileDialog, Filter property.

You can also add this to your saving code:
VB.NET:
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename, TextBox1.Text, False)

Ive had a look at

VB.NET:
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
    saveFileDialog1.FilterIndex = 2
    saveFileDialog1.RestoreDirectory = True

But ive had no luck in getting it to display in the Save As Filetype box.
 
Last edited:
Unless you have a good reason to do this in code use the visual designer to set these properties.
 
Back
Top