openfiledialog

how to change the image in the resource folder

强颜欢笑 提交于 2020-01-06 07:47:05
问题 I am a student studying c# and working on winform . I have a winform which have a splashForm which loads its background image from the resources folder. and after the splash screen in the mainForm there is a option to change the splash screen background using openFileDialog . I want to replace the image( splashimage.jpg ) from resource folder image base on the selected. And I want to copy the image from user selected to the resource folder and remove the previous image and rename the image of

C# Prevent OpenFileDialog to display ZipEntries of a Zip file

时间秒杀一切 提交于 2020-01-05 04:18:14
问题 I've a problem with an openFileDialog (default openFileDialog): I've defined a filter (LogFiles|*.log) for my OpenFileDialog. Works fine, users can only select *.log file in a folder. But, if these *.log files are in a zip archive, as the zip extension is natively recognized like a folder(CompressedFolder) by Windows and zip files displayed on the left Treeview of OpenFileDialog window, users are able to select the .*log files in the archive (and I don't want that!) The filename returned par

Open a .txt file into a richTextBox in C#

左心房为你撑大大i 提交于 2020-01-04 03:01:06
问题 I want to be able to open a .txt file up into a richtextbox in c# and also into a global variable i have made called 'notes' but don't know how to do this. This is the code i have at the moment: OpenFileDialog opentext = new OpenFileDialog(); if (opentext.ShowDialog() == DialogResult.OK) { richTextBox1.Text = opentext.FileName; Globals.notes = opentext.FileName; } Only problem is it doesn't appear in neither the richtextbox nor in the global varibale, and the global allows it to be viewed in

File Open Dialog with Encodings combobox under Vista

╄→尐↘猪︶ㄣ 提交于 2020-01-01 17:14:12
问题 I currently use the TOpenTextFileDialog as it has the Encodings option, but under Vista it appears using the older open dialog style. I'd like the new style open dialog, but with an encoding combobox that I can fill with custom strings. Basically I want the exact open dialog that Notepad shows under Vista. Of course I also need the corresponding save dialog as well. I've done some research and it seems that the OFN_ENABLETEMPLATE flag causes the Vista common dialog to fall back to the old

Why the current working directory changes when use the Open file dialog in Windows XP?

泄露秘密 提交于 2020-01-01 07:37:19
问题 I have found an strange behavior when use the open file dialog in c#. If use this code in Windows XP the current working directory changes to the path of the selected file, however if you run this code in Windows 7 the current working directory does not change. private void button1_Click(object sender, EventArgs e) { MessageBox.Show(string.Format("Current Directory {0}",Directory.GetCurrentDirectory()), "My Application",MessageBoxButtons.OK, MessageBoxIcon.Asterisk); DialogResult result =

Keep opening OpenFileDialog until selecting valid file

流过昼夜 提交于 2020-01-01 06:37:11
问题 I have code that opens the OpenFileDialog, I'm checking the size of the file to make sure it doesn't exceed specific limit. But, if the user selected a big sized file I need to warn him and lead him back to the dialog to select a different file or click cancel. This is what I've tried: OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Jpeg files, PDF files, Word files|*.jpg;*.pdf;*.doc;*.docx"; while (dialog.ShowDialog() != DialogResult.Cancel) { var size = new FileInfo(dialog

How do I get a single file name out of a File Dialog object in VBA (for MS Access 2007)?

北慕城南 提交于 2019-12-30 06:33:48
问题 How do I change my code to get the file name instead of the directory name? openDialog.InitialFilename gives me the directory name. openDialog.FileName gives me the error "Method or data member not found". Private Sub btnEditPhoto_Click() If (txtImageName > "") Then Application.FollowHyperlink txtImageName Else Dim openDialog As Office.FileDialog Set openDialog = Application.FileDialog(msoFileDialogFilePicker) openDialog.Filters.Clear openDialog.Filters.Add "JPEG Files", "*.jpg" Dim

Alternative to FolderBrowserDialog [closed]

谁都会走 提交于 2019-12-29 05:13:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 10 months ago . Is there an alternative for selecting folders in C#? Optimally I'd like to use the OpenFileDialog to select folders, or at least something similar to that. 回答1: Here you have and OpenFileOrFolder dialog and here another FolderBrowserDialog both Open Source. 回答2: Ookii Dialogs libraries have an implementation

How can I make this control (may a kind of FolderBrowser)

会有一股神秘感。 提交于 2019-12-25 03:30:51
问题 As you can see in the picture below, this looks like a file dialog and folder browser. This dialog can select only folder(not file). Is this a custom control? If so, then please give me advice on how to make it. This is a Winforms application. 回答1: It is the native Vista IFileDialog based version of OpenFileDialog. With the FOS_PICKFOLDERS turned on. That option is not exposed in .NET, it isn't available on earlier versions of Windows. You can get a wrapper for it from the Windows API Code

OpenFileDialog in Avalonia - Error with ShowAsync

自古美人都是妖i 提交于 2019-12-25 01:12:55
问题 Background: I have been using Avalonia to develop a cross-platform UI. To learn it I am trying to creating a simple program that opens a .txt file using OpenFileDialog and displays its contents in a ComboBox in another window. I am trying to write a method that opens file dialog and returns the path the user opened. I am using a button with a Click event to open file dialog and put the specified path in a TextBox for the user to see. Since I am new to both WPF and Avalonia, I am not sure how