savefiledialog

C#, WPF - OpenFileDialog does not appear

淺唱寂寞╮ 提交于 2019-11-28 09:21:37
I have been searching up and down the web and unfortunately never came across an issue quite like mine, so here goes: My C# WPF application won't show me no OpenFileDialogs or SafeFileDialogs. private void btnBrowseNet_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.CheckPathExists = true; ofd.Multiselect = false; ofd.Title = "Open Network Configuration Batch file..."; ofd.ValidateNames = true; ofd.Filter = "Comma Seperated Value Files|*.csv"; if (ofd.ShowDialog() == true) { //... } } This exact code does in one occasion exactly what it is supposed to

empty path name not legal

我是研究僧i 提交于 2019-11-28 08:36:10
问题 I have a "save" button so when users click, it will do a saving of xml file(xml serialization). A savefiledialog is used here and when i press cancel without selecting any file an "Argument Exception" occurs and says "Empty path name is not legal". How do i handle this exception? I would like the form to remain the same even without any path selected in the savefiledialog. Many thanks. My savefiledialog snippet: private void SaveButton_Click(object sender, RoutedEventArgs e) { string savepath

Word VBA - DocumentBeforeSave event?

这一生的挚爱 提交于 2019-11-28 06:11:52
问题 I am using the following VBA code to make a message box appear while saving the Word document, Public WithEvents appWord as Word.Application Private Sub appWord_DocumentBeforeSave _ (ByVal Doc As Document, _ SaveAsUI As Boolean, _ Cancel As Boolean) Dim intResponse As Integer intResponse = MsgBox("Do you really want to " _ & "save the document?", _ vbYesNo) If intResponse = vbNo Then Cancel = True End Sub This code was written in a Class. But this does not work. Nothing happens when saving.

VBA: Get Excel FileDialogOpen to point to “My Computer” by default

跟風遠走 提交于 2019-11-28 01:43:07
问题 I'm trying to get excels save and open dialog boxes to open to "my computer" by default so the user can select a drive from there. I have got the dialog boxes to open to any path on any drive or my documents etc but can't seem to find a way for it to open to my computer. This is the code i'm using at the moment and it works fine for a known path: MsgBox objFolders("desktop") ChDrive objFolders("desktop") ChDir objFolders("desktop") strFileName = appRemoteApp.Workbooks("Export Template.xlsm")

How can I use the common Save As dialog from VBScript?

核能气质少年 提交于 2019-11-27 14:01:17
I'd like to have my VBScript display the Windows Save As dialog box, but I could not find out how to do it. Using this code: Dim sfd Set sfd = CreateObject("UserAccounts.CommonDialog") sfd.ShowOpen I can get an Open dialog, but there is no ShowSave method for this object (as there seems to be for a similar object in Visual Basic non-script). I searched StackOverflow and googled for "[vbscript] save dialog" (and with "Windows Script Host"), but I only found threads about accessing common dialogs from web pages and a solution for the BrowseForFolder dialog and nothing really about calling the

How to set name of file downloaded from browser?

≯℡__Kan透↙ 提交于 2019-11-27 08:33:10
I'm writing a web application that, among other things, allows users to upload files to my server. In order to prevent name clashes and to organize the files, I rename them once they are put on my server. By keeping track of the original file name I can communicate with the file's owner without them ever knowing I changed the file name on the back end. That is, until they go do download the file. In that case they're prompted to download a file with a unfamiliar name. My question is, is there any way to specify the name of a file to be downloaded using just HTML? So a user uploads a file named

A Generic error occurs at GDI+ at Bitmap.Save() after using SaveFileDialog

让人想犯罪 __ 提交于 2019-11-27 03:04:18
问题 I use the following code block with some more code inside the using block: using (System.Drawing.Bitmap tempImg = (System.Drawing.Bitmap)tempObj.GetData(System.Windows.Forms.DataFormats.Bitmap)) { // ... tempImg.Save("..\\..\\testdata\\tempImg.bmp", ImageFormat.Bmp); // ... } But I still get the error: A Generic Error occured at GDI+ only after I make some action which is not related to the code inside the using block. In other times this works well. Also the tempImg.bmp is a temporary file,

C#, WPF - OpenFileDialog does not appear

寵の児 提交于 2019-11-27 02:51:47
问题 I have been searching up and down the web and unfortunately never came across an issue quite like mine, so here goes: My C# WPF application won't show me no OpenFileDialogs or SafeFileDialogs. private void btnBrowseNet_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.CheckPathExists = true; ofd.Multiselect = false; ofd.Title = "Open Network Configuration Batch file..."; ofd.ValidateNames = true; ofd.Filter = "Comma Seperated Value Files|*.csv"; if (ofd

How can I use the common Save As dialog from VBScript?

帅比萌擦擦* 提交于 2019-11-26 16:34:35
问题 I'd like to have my VBScript display the Windows Save As dialog box, but I could not find out how to do it. Using this code: Dim sfd Set sfd = CreateObject("UserAccounts.CommonDialog") sfd.ShowOpen I can get an Open dialog, but there is no ShowSave method for this object (as there seems to be for a similar object in Visual Basic non-script). I searched StackOverflow and googled for "[vbscript] save dialog" (and with "Windows Script Host"), but I only found threads about accessing common

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-11-26 15:11:53
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: 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 download attribute data uri's Found the reference: http://paxcel.net/blog/savedownload-file-using-html5-javascript