savefiledialog

Save text from rich text box with C#

送分小仙女□ 提交于 2019-12-20 07:40:02
问题 This question has been answered. I've improved the code a bit (at least I think so). It now reminds of the aceepted answer to the question Open file in rich text box with C#. If I haven't made any mistakes (which I may have), the code should save a file with text from the rich text box rtfMain. The default file extension is .txt. You can also use the file extension .rtf. private void menuFileSave_Click(object sender, EventArgs e) { // Create a new SaveFileDialog object using (SaveFileDialog

Save filedialog not working

社会主义新天地 提交于 2019-12-20 04:59:14
问题 Bit of an odd one here , I'm writing an app which gives a save file option , the save file dialog is coded up as normal SaveFileDialog ofd = new SaveFileDialog(); the dialog box comes up no problem and clicking save doesn't throw up any errors however no file is saved and I'm not sure why , any ideas ? I've googled it and can't find a similar problem 回答1: The SaveFileDialog class doesn't save anything, it prompts the user to choose a location and a file name to save the file. It is your job

FileStream can't access the file because it's being used by another process

◇◆丶佛笑我妖孽 提交于 2019-12-20 02:11:33
问题 I'm new at web app in ASP.NET and I came across this problem. I have a page whe there is a Button to download a template.xls that is previously stored at a SharePoint page. I have the download method and it's working just fine. The template in question is being saved where it should be, on a folder where my web app is located, on my local IIS. The problem is to open this file to the end user. I need a popup to be displayed to the user, so he can open/save this template.xls I'm using the

Save file dialog in MVC

被刻印的时光 ゝ 提交于 2019-12-19 07:47:10
问题 How to create save file dialog in MVC application? I couldn't find any example. Thanks in advance. 回答1: By using the Content-Disposition header to attachment when returning the file to download: public ActionResult Download() { return File(@"c:\work\report.pdf", "application/pdf", "reoprt.pdf"); } Or if the file to download is dynamically generated: public ActionResult Download() { byte[] pdf = ... get the contents of the report return File(pdf, "application/pdf", "reoprt.pdf"); } 来源: https:/

Response.WriteFile() — not working asp net mvc 4.5

我是研究僧i 提交于 2019-12-18 09:48:13
问题 I've looked at many resources and the following should work, however my save as dialog box is never showing (not browser specific): Response.ContentType = "application/octet-stream"; string downloadName = "Request "+request.RequestID+ "_researchExport.doc"; Response.AddHeader("Content-Length", new System.IO.FileInfo(FileName).Length.ToString()); Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0};", downloadName)); Response.WriteFile(FileName); Response.Flush();

How do I use savefiledialog in vb.net

↘锁芯ラ 提交于 2019-12-18 09:03:23
问题 I have a program called TextEditPro and I just started it, I'm running into a problem. When I had the code for clicking Save As... I don't know how to use the savefiledialog so when you click Save As it will pop up! Any help? 回答1: Learn to use MSDN - the documentation for SaveFileDialog has an example Private Sub button1_Click(sender As Object, e As System.EventArgs) Dim myStream As Stream Dim saveFileDialog1 As New SaveFileDialog() saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files

Default Filename SaveFileDialog

一曲冷凌霜 提交于 2019-12-18 05:42:48
问题 I would like to create SaveFileDialog with default file name from value DataGridViewCells So far I tried private void buttonSave_Click(object sender, EventArgs e) { //first //mySaveFileDialog.FileName = myDataGridView.SelectedCells[2].Value.ToString(); //second SaveFileDialog saveFile = new SaveFileDialog(); saveFile.FileName = myDataGridView.SelectedCells[2].Value.ToString(); saveFile.ShowDialog(); } Can anyone help me solve this? 回答1: The SaveFileDialog has a property intended for this

How to make a browser display a “save as dialog” so the user can save the content of a string to a file on his system?

痴心易碎 提交于 2019-12-17 02:30:14
问题 How can I make a browser display a "save as dialog" so the user can save the content of a string to a file on his system? For example: var myString = "my string with some stuff"; save_to_filesystem(myString,"myString.txt"); Resulting in something like this: 回答1: In case anyone is still wondering... I did it like this: <a href="data:application/xml;charset=utf-8,your code here" download="filename.html">Save</a> cant remember my source but it uses the following techniques\features: html5

How do i save a file in fastcoloredtextbox?

帅比萌擦擦* 提交于 2019-12-14 03:22:17
问题 I'm developing a syntax editor in C# where you can write code in the FastColoredTextBox component, then saving it as a .html file. However, I have the code for the Save As option. The only problem I have is when the user saves the .html file, the same Save As dialog pops up. But we have already saved it before. I want to just press Ctrl+S on the keyboard and it will automatically save the file changes after saving as a .html file of course. Here's the code I have for the Save As option.

How to debug hanging SaveFileDialog

女生的网名这么多〃 提交于 2019-12-13 23:12:15
问题 Several users of my VSTO add-ins report hangs that occur when a "Save as" dialog should be displayed. This happens with an Excel add-in as well as a Word add-in. Interestingly, both applications also tend to hang when invoking the "Save as" command on a document. I am having a hard time to troubleshoot this because the entire application just freezes after // using System.Windows.Forms; SaveFileDialog dlg = new SaveFileDialog(); // lines to configure dlg left out dlg.ShowDialog(); When