Hi Guys!
Question: I have the following code in my WordPad.
Code:
If bEdited = True Then
            Dim check As MsgBoxResult
            check = MsgBox("Text has not been saved. Save changes?", MsgBoxStyle.YesNo)
            If check = MsgBoxResult.Yes Then
                If tb1.Text <> "" Then
                    sfd.Filter = "Text Files (*.txt)|*.txt"
                    sfd.FilterIndex = 1
                    sfd.ShowDialog()
                    If sfd.FileName <> "" Then
                        FileOpen(1, sfd.FileName, OpenMode.Output)
                        PrintLine(1, tb1.Text)
                        FileClose(1)
                        Me.Text = sfd.FileName
                    End If
                End If
            End If
            If check = MsgBoxResult.No Then
                Application.Exit()
            End If
        End If
        bEdited = False 
        Application.Exit()
This Code works OK but does not do what I would like it to do, as you can see it will bring up the save dialog any time something was changed. Now, if the user created a new file that would be acceptable, but if the user has made changes to an existing File it should only prompt (Yes/No) and if “Yes”save the File automatically.
How would I go about doing this??
Thanks!