Results 1 to 4 of 4

Thread: FileStream Question

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    27

    FileStream Question

    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:

    Code:
    if x = false
                 If saveFileDialog1.ShowDialog() = DialogResult.OK Then
                      fileStream = CType _
                      (saveFileDialog1.OpenFile(), System.IO.FileStream)
                 End If
    
       Else
                 fileStream = existingFilePath
    End If
    How can I assign the file stream an existing file path?

    Also, is there a better way to save an existing file without overwriting the existing file completely?
    Last edited by mk48; May 4th, 2012 at 01:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width