This is what I have Done..and this is what is wrong:

What I have done is made a windows form project. On Form2, 3, and 4..I have a Control Tab..and this control Tab is holding Images and text boxes.

What I want to do is implement SAVE into my menustrip through the saveDialog.

I have in my SaveDialog Properties the filters:
(*.txt)|*.txt|All files (*.*)|*.*

The code I am using is from a notepad tutorial..which more than likely is the problem LOL...but this is it anyways:

Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
        SaveFileDialog1.ShowDialog()
        If My.Computer.FileSystem.FileExists(SaveFileDialog1.FileName) Then
            Dim ask As MsgBoxResult
            ask = MsgBox("File already exists, would you like to replace it?", MsgBoxStyle.YesNo, "File Exists")
            If ask = MsgBoxResult.No Then
                SaveFileDialog1.ShowDialog()
            ElseIf ask = MsgBoxResult.Yes Then
                My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)
            End If
        Else
            My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)
        End If
    End Sub
End Class

I have the feeling that the whole problem with this code is here:

My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)

I feel this way because for starters, this would work for a notepad as it really only has 1 text box.

My form that I am trying to save has many text boxes. What I want to do is save the whole form in its entirety.

I have Tried changing My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)

TO:
(SaveFileDialog1.FileName, frmWeekTwo, False)
and it gives me an error of not being declared..
I have tried many different versions and i Just cant seem to get it!

Does anyone know how to code this to make it save the whole form in the state it is in?

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

>My form that I am trying to save has many text boxes. What I want to do is save the whole form in its entirety.

You can append/concatenate string from various textboxes.

...(SaveFileDialog1.FileName,TextBox1.Text & TextBox2.Text , False)
This question has already been answered. Start a new discussion instead.