Hello world of DaniWeb, I've asked a similar question to this one before but now I'm trying to find an answer to a different problem. You see, I have made a text editing application and, as you might have guessed yourself, I needed to add save features. Well, what I have implemented so far is the ordinary "Save As..." feature which I made by using a common SaveFileDialog. Now it's time for the hard part. I need to add the "Save" function located in many Windows applications (Notepad etc.). This is what I'm working on at this moment but it doesn't seem to work. Please have a quick look:
Public Class Form1 Dim Saved As Boolean = False Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click If Saved = False Then If (SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then RichTextBox1.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.TextTextOleObjs) Me.Text = "" & SaveFileDialog1.FileName & " - NoteEditor Pro" Saved = True ElseIf Saved = True Then ' I don't know what to type here. That's why I'm asking for your help after all! :P End If End If End Sub
As you can see, I've used a nice method to determine whether data was previously saved so the Save function will be called. The thing is that I don't know how to get the save path so I can replace the file that was previously saved with its new version if you know what I mean. Just use Notepad's save function (not "Save As...") and you'll understand what I'm trying to say. I'm looking forward to an easy-to-understand answer. Thank you in advance!