How to save a file using save file dialog in VB.Net 2003 RRS feed

  • Question

  • Hey, can anyone help me??? I want to save a text file using visual 2003 with save file dialog, but I don't know how to do that....
    Please help me......
    Thanx before
    Thursday, May 14, 2009 6:55 AM


  • Hi Friend,
      Using save file dialogue you will get the full file path of the file which you want to save.
    You will get ti from the FileName of the fileDialogue object. Please do check the DialogueResult object of the filedialoge object, to check it was a cancel or save button click! You can use the filename in a filestream or something to save the data.

            Dim dDilaoge As New SaveFileDialog
            Dim filename As String = dDilaoge.FileName
            Dim streamWriter As StreamWriter = File.CreateText(filename)
            streamWriter.Write("Your Text here")
    -- Thanks Ajith R [Remember to Mark as Answer if it is Helpful.]
    Thursday, May 14, 2009 7:05 AM
  • Hi Strike_freedom,

    I've reproduce Ajith's source code. It works.

    For your issue, here are some useful documents that show information on SaveFileDialog class and StreamWriter class.
    SaveFileDialog Class
    StreamWriter Class

    If you have any further concern, please feel free to let me know.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, May 15, 2009 9:02 AM

All replies