I am trying to find the best way to implement the concept of Save and Save As. I currently have a save option which will provide a save dialog. I want to be able to both save a new file and also save changes to an existing file. The problem that I have is that I have only one save function which will always display a save dialog. I realize that I can have another function to bypass the save dialog however I am looking to consolidate my code by adding a check to the existing save function. If x = false meaning that the file has not been saved before and so we can display a dialog save. Else, if x = true, we already have a file and we simply want to save the existing file:
How can I assign the file stream an existing file path?Code:if x = false If saveFileDialog1.ShowDialog() = DialogResult.OK Then fileStream = CType _ (saveFileDialog1.OpenFile(), System.IO.FileStream) End If Else fileStream = existingFilePath End If
Also, is there a better way to save an existing file without overwriting the existing file completely?




Reply With Quote