Results 1 to 7 of 7

Thread: Working with SaveFileDialog. [Resolved]

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question Working with SaveFileDialog. [Resolved]

    I want to export my database file using SaveFileDialog. This database file is working in the background. It is not seen when the program is running.

    From the SaveFileDialog, I can only set the destination of the file to be saved, right?

    How can I set the source of the file to be saved?

    Can I do it on the SaveFileDialog's property window?

    Please guide. Thank you.
    Last edited by albertlse; Aug 21st, 2003 at 08:03 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I assume you are going to save the file (any file) where your exe is running (you can change this though) .

    VB Code:
    1. Private sub SaveMe()
    2.  
    3. dim pth As String = Application.StartupPath
    4.  
    5. SaveDig.Filter = "Rich Text Format|*.rtf"
    6. SaveDig.InitialDirectory = pth
    7. SaveDig.FileName = ""
    8.  
    9. If SaveDig.ShowDialog = DialogResult.OK Then
    10.  
    11. 'Now you set the destination
    12. FilName = SaveDig.FileName
    13.  
    14. 'here's an example
    15. RichTextBox1.SaveFile(FilName)
    16. MessageBox.Show("File was saved successfully")
    17. End If

  3. #3

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question

    I think you had mistaken what I really want.

    I'm trying to save a backup of my "database.mdb" file to a new location.

    For example: My source file is at "C:\database.mdb".
    It is opened when the program is running, and it works in the background.
    By opening the SaveFileDialog, I can enter the filename, and select the location where I want to save the backup file to.
    How can I do so with SaveFileDialog?

    Please let me know if you are still not clear.

  4. #4
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    //How can I set the source of the file to be saved?

    This is done entirely through code and has nothing whatsoever to do with SaveFileDialog. That's what Pirate was trying to show you with:

    RichTextBox1.SaveFile(FilName)

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    That's right . I just wanted to show you how to set the path and then use SaveFile property of the richtextbox . You still have the option of copying the file to the destination but the file must be locked (closed) .

  6. #6

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question

    So what I was thinking all the while is true. SaveFileDialog is only used to set the destination of the file to be saved.

    To set a source file (database file), how can I do?

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by albertlse
    So what I was thinking all the while is true. SaveFileDialog is only used to set the destination of the file to be saved.

    To set a source file (database file), how can I do?
    It's shown in the code I posted above !

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