The AppendAllText can append into existing file and can create a file if no file exist. the WriteAllText can Write into new created file and overwrite the existing file.

I'm trying to find another alltext for what I want to happen.

What I want to do is to save my textboxcontent.text into txt file. I want to save 3 different content that will be displayed into my textboxcontent.text And I only have one button.

That one button will open savefiledialog but with the code I have, I can only do 2 things, Write and Append.

Now, This is what suppose to happen.

*If I save the textcontent.text to an existing txt file, it will prompt message box "Do you want to overwrite this file?" And even if I click Yes, it will not allow to.
I must be able to create new txt file since I was not able to overwrite the file.
The reason is because I don't want to delete or overwrite the existing file with important information saved in it.

I hope somebody can help me.

This is the code I have.

Code:
Imports System.io
Private lastSaveFileName As String = String.Empty
Private Function GetSaveFileName3(ByVal suggestedName As String) As String
    Using sfd3 As New SaveFileDialog()
        sfd3.Filter = "Text Files (*.txt) |*.txt"
        sfd3.FileName = suggestedName
        sfd3.OverwritePrompt = True


        If DialogResult.OK Then

        End If
        If sfd3.ShowDialog() = DialogResult.OK Then
            MessageBox.Show(
            Me, "Your activity is not saved! This file have records from your last session, you cannot overwrite this file. Please create new file to save new records.",
            "Save error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation
        )
        Else


        End If
        Return String.Empty
    End Using
    
End Function
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    lastSaveFileName = GetSaveFileName3(lastSaveFileName)
    If Not String.IsNullOrEmpty(lastSaveFileName) Then
        File.AppendAllText(lastSaveFileName, TextContent.Text)
    End If