FAQ Database Discussion Community


SaveFileDialog InitialDirectory

c#,savefiledialog
I have an Outlook 2013 Addin written with VSTO and VS2013. I have a save file dialog where I set Initial Directory to a network mount. Saving to the path with MailItem.SaveAs() works, but when I use it with saveFileDialog1.InitialDirectory = "W:/etc/etc/"; I just get my Documents library as the...

Save file dialog An unhandled exception

c#,savefiledialog
I have some problems about savefiledialog c#, I have an unhandled exception of type System.NullReferenceException when I debug, this's code: private void saveToolStripMenuItem_Click(object sender, System.EventArgs e) { switch (fileName) { case "": { saveFileDialog1 = new SaveFileDialog { Filter = @"Image files (*.bmp)|*.bmp|All files (*.*)|*.*", FileName = "MyPicture.bmp" }; if...

Ask location to save text file created using c#

c#,winforms,datagridview,savefiledialog
i am exporting datagridview data into format of text file, i tried the below code string dirLocationString = @"C:\Users\palanar\Desktop\result.txt"; StreamWriter sW = new StreamWriter(dirLocationString); string lines = ""; lines = "DateTime" + "\t" + "TestStatus" + "\t" + "BatPackSN" + "\t" + "CellSN" + "\t" + "BlockSN" + "\t" +...

Saving txt file going to wrong location

c#,winforms,streamwriter,savefiledialog
I'm trying to save a text file log to a specific location from my Windows Form project. I set the InitialDirectory to Path.GetFullPath(filePath) where I pass in filePath which is set as a simple path of "C:\MyWork\EventLogs\" The log saves on Exit of the program (when a user closes or...

WPF C# SaveFileDialog - Reopen Dialog if filename exists in alternate folder

wpf,savefiledialog
I have a WPF project where I have a "Backup" folder that autosaves. If the user chooses a different name when they save the project, I check the Backup folder first and warn them if there's already a project with that name. If so, I want to reopen the SaveFileDialog...

Add an extention to the file you want to save

c++,winapi,file-extension,savefiledialog
The problem is that I need to add an extension to the file name when I save it. Solution like outfile.open(filename + ".txt") doesn't seems to work in my case. There is my code: SaveFileDialog* saveFileDialog1 = new SaveFileDialog(); int saveAs(const string& outFileName) { string bufFile("C:\\Windows\\tmp.XXXXXX"); string outFile(saveFileDialog1->NewFileName); string line;...

VB SaveFileDialog if cancel then

vb.net,visual-studio,savefiledialog,cancel-button
When the user presses the "Cancel" button in SaveFileDialog I want to rename a textlabel. Private Sub SaveFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk Label6.Text = "Saved!" End sub This is working for the "Save" Button. I don't know how to do it for the "Cancel" button. Thanks...

PHP save file without save as dialog

php,content-type,savefiledialog
I'm creating MS Office Word document with PHP as following: header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment;Filename=filename.doc"); header("Content-Transfer-Encoding: binary"); But I need to save file to the server without save as dialog to be able to do something with the created *.doc file and give it to user only after the modification. So...

Writing a File to the Specified Folder

c#,streamwriter,visual-studio-express,savefiledialog
This question is in conjunction with my other: Write a text file to a sub-folder. This time, I have a program that has a text folder to open a file, then extract data from that file. Then I can save it by saying where to save it. private void btnExtract1_Click(object...