Search Results

Search found 96 results on 4 pages for 'openfiledialog'.

Page 1/4 | 1 2 3 4  | Next Page >

  • OpenFileDialog.AutoUpgradeEnabled doesn't work under 7?

    - by Digiku
    If I specify OpenFileDialog.AutoUpgradeEnabled = true, my program still shows the old XP-style dialog. Any idea why this would happen? This is after I enable theming in Main() [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Primary()); } and this is my dialog code: private void OpenProgramFile() { OpenFileDialog programFileDialog = new OpenFileDialog(); programFileDialog.Filter = "Program files (*.exe;*.lnk)|*.exe|All files (*.*)|*.*"; programFileDialog.FilterIndex = 0; programFileDialog.Title = "Select program file"; programFileDialog.AutoUpgradeEnabled = true; programFileDialog.ShowHelp = true; DialogResult fileResult = programFileDialog.ShowDialog(); if (fileResult != DialogResult.OK) return false; programFileDialog.Dispose(); } So why would AutoUpgradeEnabled not work on 7?

    Read the article

  • OpenFileDialog.AutoUpgradeEnabled doesn't work under Vista or 7?

    - by Digiku
    If I specify OpenFileDialog.AutoUpgradeEnabled = true, my program still shows the old XP-style dialog. Any idea why this would happen? This is after I enable theming in Main() [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Primary()); } and this is my dialog code: private void OpenProgramFile() { OpenFileDialog programFileDialog = new OpenFileDialog(); programFileDialog.Filter = "Program files (*.exe;*.lnk)|*.exe|All files (*.*)|*.*"; programFileDialog.FilterIndex = 0; programFileDialog.Title = "Select program file"; programFileDialog.AutoUpgradeEnabled = true; programFileDialog.ShowHelp = true; DialogResult fileResult = programFileDialog.ShowDialog(); if (fileResult != DialogResult.OK) return false; programFileDialog.Dispose(); } So why would AutoUpgradeEnabled not work?

    Read the article

  • Mouse left button up event and openfiledialog

    - by phm
    I have few images in a grid, then when i click a button, a "open file dialog" comes up.(of course, over the images) Microsoft.Win32.OpenFileDialog dlgOpenFiles = new Microsoft.Win32.OpenFileDialog(); dlgOpenFile.DoModal(); The images have a LeftButtonUp event attached. The problem is that if i select a file by double clicking it, the open file dialog closes(which is good), but besides that, the image behind the clicked file is receiving a LeftButtonUp message which is not good at all. I am using wpf/c#/vs2010

    Read the article

  • OpenFileDialog - only display filenames that have no extensions

    - by fraXis
    Hello, I have the following code in my C# program: OpenFileDialog fDialog = new OpenFileDialog(); fDialog.Title = "Open a file"; fDialog.Filter = "NCF files (*.ncf)|*.ncf|All files (*.*)|*.*|No Extensions (*.)|*."; I want to be able to have the user pick from the following: .NCF (files with .NCF extension only) *.* (all files) and files that have no extensions such as: readme (with no .txt) I know *.* will do this, but it also displays the .NCF, .TXT, and all other files in the same directory. I just want to be able to display filenames that have no extensions. Filtering with *. does not do the trick. Is there a way I can do this with C#? Thanks.

    Read the article

  • How does one use OpenFileDialog in C# in visual Studio 2010

    - by xarzu
    I have written a custom dialog (form) that I can use in a C# program that behaves much like a "File - Open" menu command and brings up a window where a user can select a file or directory. The question I have is this. It has "My Computer" as its root. How can I have it so that it searches on a Network? If the file or directory is located on a network. Or better yet, in Visual Studio 2010, is there some sort of canned FileOpenDialog that I can use right away? I tried calling the OpenFileDialog as described in the example code at http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx but the compiler does not seem to like DialogResult.OK as used in this line of code: if(openFileDialog1.ShowDialog() == DialogResult.OK) The compiler says: Error 1 'System.Nullable' does not contain a definition for 'OK' and no extension method 'OK' accepting a first argument of type 'System.Nullable' could be found (are you missing a using directive or an assembly reference?) I tried using the namespace Microsoft.Win32 instead of System.Windows.Forms and neither worked. They both produced this error.

    Read the article

  • How get file names using OpenFileDialog in .NET (1000+ file multiselect)

    - by Cole
    Maybe some of you have come across this before.... I am opening files for parsing. I'm using OpenFileDialog, of course, but i'm limited to a buffer of 2048 on the .FileNames string. Thus, I can only select a few hundred files. This is OK for most cases. However, fore example, I have in one case 1400 files to open. Do you know a way to do this with the open file dialog. I just want the string array of .FileNames, I pass that to parser class. I was also thinking of offering a FolderBrowserDialog option and then I'd use some other method to just loop through all the files in a directory, like the DirectoryInfo class. I'd do this as a last resort if I can't have an all in one solution.

    Read the article

  • OpenFileDialog directing to a file 2 directories back

    - by steve
    I'm having problems in visual basic programming. Currently I open a file using an open file dialog window and navigating to a file to open it. I want to be able to write a simple line saying ( and this is the best way I can describe it), Open this file "....\users.text". Please can someone help?

    Read the article

  • Autoupgradeenable property of openfiledialog.

    - by Harikrishna
    I had need of showing open file dialog in winform application. And one property of the file dialog, autoupgradeenabled which I set as a true, which is for updating the open file dialog according to operating system, like if application is running on xp then dialog is displayed different as in wista or window 7. So when I used that property as a true, and once in the machine where there was xp with 2.0 .net framework that open file dialog could not be opened. So I tried by doing it false then also it could not be opened in the machine with the xp and 2.0 framework. Then I tried by commenting that whole line means I removed that property from the code, then I tried and it was fine in xp machine with 2.0 framework. So problem is I cannot understand that why that property is not working by setting it false or true. Because by setting that property is should work in all os with all framework and dialog should be changed according to os. If not,then what is the meaning of that property ?

    Read the article

  • Wxpython cut copy paste and openfiledialog...

    - by Marius
    i have a web browser made in python with menu. in one menu i have cut copy paste but no functionality and i need to make them work. i need an example of class oncopy.(event menu) Open file i manage to work like this .takes file and print on screen the link to that file but how can make open dialog to open a file at least one type of file?

    Read the article

  • OpenFileDialog in C#

    An OpenFileDialog control is used to browse and select a file on a computer. This article demonstrates how to use a windows Forms open file dialog in C#.

    Read the article

  • How do I set the Initial Directory on an OpenFileDIalog to the users `Downloads` folder in C#

    - by JMK
    Ok so I have an OpenFileDialog and I want to set the initial directory to the users 'Download' folder. This is an internal application and, therefore, I am sure that the user will be using Windows 7. var ofd = new OpenFileDialog(); //This doesn't work ofd.InitialDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Downloads"); //This doesn't work either ofd.InitialDirectory = @"%USERPROFILE%\Downloads"; ofd.Filter = "Zip Files|*.zip"; ofd.ShowDialog(); txtFooBar.Text = ofd.FileName; I have tried the above so far and neither work. No Exception is thrown, it just doesn't set the initial directory to the downloads folder. Where am I going wrong? Thanks

    Read the article

  • OPenFileDialog in win 7

    - by dr_csharp
    hi friends whats wrong with OpenFileDialog in win 7 ? i used to do like this : OpenFileDialog file = new OpenFileDialog(); file.InitializeLifetimeService(); file.InitialDirectory = Application.StartupPath; file.ShowDialog(); but in win 7, programe goes to "not responding" state. thanks

    Read the article

  • How to use White to test OpenFileDialog on Silverlight 4.0 application?

    - by Duncan Bayne
    I'm trying to test an OpenFileDialog that is created when the user clicks on a button in my Silverlight 4.0 application. According to the FAQ, the correct way of finding modal dialogs is this: Window mainWindow = application.GetWindow("main"); List<Window> modalWindows = mainWindow.ModalWindows(); //list of all the modal windows belong to the window. Window childWindow = mainWindow.ModalWindow("child"); //modal window with title "child" childWindow.IsModal; //returns true However, I'm testing a Silverlight application, using the White.WebBrowser.Silverlight.SilverlightDocument class, which doesn't appear to have a ModalWindows() collection on it. Could someone please give me a hint as to what I'm doing wrong, & how I should be testing this?

    Read the article

  • How to customize an OpenFileDialog using nested types?

    - by vitorbal
    Say I wanted to customize an OpenFileDialog and change, for example, the way the filter for file extensions work, as in the case of this question. After I pointed out to the author of said question that the OpenFileDialog is not inheritable, I got a comment with the following: Even though the OpenFileDialog is sealed (not inheritable), you may use it as a nested type. For instance, using a property that will get the NativeDialog. Then, you write your method always using the NativeDialog property and you're done. My question is, can someone provide me with an example code on how would I proceed on doing something like that? I'm kind of new to the concept of nested types so I'm having a hard time figuring that out by myself, and I searched around the web and couldn't find anything too concrete about it. Thanks!

    Read the article

  • OpenFileDialog RestoreDirectory as no effect if Multiselect is set to true

    - by Simon T.
    We use OpenFileDialog across our application to select files. So far, we never used Multiselect. We set RestoreDirectory to true so that any time we open the dialog we get the user to the last directory used. If I set Multiselect to true, the directory from which the files are selected is not remembered. The dialog shows the last directory used when Multiselect was set to false. By the way, we create a new instance of OpenFileDialog. The environment: Windows XP VS 2008 targeting framework 3.5 C#

    Read the article

  • .net OpenFileDialog changing the CurrentDirectory

    - by meowing
    Hi, I am using OpenFileDialog. But using it changes the Environment.CurrentDirectory. Using the RestoreDirectory property solves this issue, but I'm using external dlls that I can't control that don't use RestoreDirectory. Is there a way to make it true as default? Or is there any other solution to this annoying problem? Thanks.

    Read the article

  • Call OpenFileDialog Silverlight from JavaScript

    - by PeterEysermans
    I'm trying to call a function in a Silverlight 4 component to open a file dialog and upload a file to the server. Everything works well within Silverlight but I'd like to call the component from JavaScript. So I call the button click handler from a C#-function which is [ScriptableMember]. I get the following error when calling the function: System.Security.SecurityException: Dialogs must be user-initiated. at System.Windows.Browser.ManagedObjectInfo.Invoke(ManagedObject obj, InvokeType invokeType, String memberName, ScriptParam[] args) at System.Windows.Hosting.ManagedHost.InvokeScriptableMember(IntPtr pHandle, Int32 nMemberID, Int32 nInvokeType, Int32 nArgCount, ScriptParam[] pArgs, ScriptParam& pResult, ExceptionInfo& pExcepInfo) I based my code on the tutorial by Tim Heuer that can be found here: http://www.silverlight.net/learn/videos/silverlight-videos/openfiledialog-and-file-upload/ I understand why the error is thrown, sort of, the 'click' from the user is done in JavaScript and probably is not going through to Silverlight. For Silverlight this is merely a function call. Is this new policy from Silverlight 4? Is it still possible to only use Silverlight behind to screens to upload a file? Any help is appreciated.

    Read the article

  • Why is a NullReferenceException thrown when a ToolStrip button is clicked twice with code in the `Click` event handler?

    - by Patrick
    I created a clean WindowsFormsApplication solution, added a ToolStrip to the main form, and placed one button on it. I've added also an OpenFileDialog, so that the Click event of the ToolStripButton looks like the following: private void toolStripButton1_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); } I didn't change any other properties or events. The funny thing is that when I double-click the ToolStripButton (the second click must be quite fast, before the dialog opens), then cancel both dialogs (or choose a file, it doesn't really matter) and then click in the client area of main form, a NullReferenceException crashes the application (error details attached at the end of the post). Please note that the Click event is implemented while DoubleClick is not. What's even more strange that when the OpenFileDialog is replaced by any user-implemented form, the ToolStripButton blocks from being clicked twice. I'm using VS2008 with .NET3.5. I didn't change many options in VS (only fontsize, workspace folder and line numbering). Does anyone know how to solve this? It is 100% replicable on my machine, is it on others too? One solution that I can think of is disabling the button before calling OpenFileDialog.ShowDialog() and then enabling the button back (but it's not nice). Any other ideas? And now the promised error details: System.NullReferenceException was unhandled Message="Object reference not set to an instance of an object." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.NativeWindow.WindowClass.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG& msg, HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at WindowsFormsApplication1.Program.Main() w C:\Users\Marchewek\Desktop\Workspaces\VisualStudio\WindowsFormsApplication1\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

    Read the article

  • Changing directory in Open File Dialog programatically.

    - by ofarooq
    Hi All, I have a customized OpenFileDialog (VS2008, C#, Windows Forms) with a ComboBox. The ComboBox will have a list of paths which the user can select. My question, is there a way I can change the directory in Open File Dialog to point to the path in the combobox selected item. InitialDirectory works only before I open the dialog, I wanted a way to change the directory programatically after the dialog is open. Thanks

    Read the article

  • Silverlight file upload - file is in use by another process (Excel, Word)

    - by walkor
    Hi, all. I have a problem with uploading of the file in Silverlight application. Here is a code sample. In case when this file is opened in other application (excel or word for example) it fails to open it, otherwise it's working fine. I'm using OpenFileDialog to choose the file and pass it to this function. private byte[] GetFileContent(FileInfo file) { var result = new byte[] {}; try { using (var fs = file.OpenRead()) { result = new byte[file.Length]; fs.Read(result, 0, (int)file.Length); } } catch (Exception e) { // File is in use } return result; } Is there any way i can access this file or should i just notify the user that the file is locked?

    Read the article

  • Check if file is locked or catch error for trying to open

    - by Duncan Matheson
    I'm trying to handle the problem where a user can try to open, with an OpenFileDialog, a file that is open by Excel. Using the simple FileInfo.OpenRead(), it chucks an IOException, "The process cannot access the file 'cakes.xls' because it is being used by another process." This would be fine to display to the user except that the user will actually get "Debugging resource strings are unavailable" nonsense. It seems not possible to open a file that is open by another process, since using FileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite) chucks a SecurityException, "File operation not permitted. Access to path 'C:\whatever\cakes.xls' is denied.", for any file. Rather unhelpful. So it's down to either finding some way of checking if the file is locked, or trying to catch the IOException. I don't want to catch all IOExceptions and assume they're all locked file errors, so I need some sort of way of classifying this type of exception as this error... but the "Debugging resource strings" nonsense along with the fact that that message itself is probably localized makes it tricky. I'm partial trust, so I can't use Marshal.GetHRForException. So: Is there any sensible way of either check if a file is locked, or at least determining if this problem occurred without just catching all IOExceptions?

    Read the article

  • Is it possible to replace the system open file dialog?

    - by Edwin
    I want to replace the standard system open file dialog with the one I wrote, that means no matter within which programs you are opening a file, my dialog will be shown instead of the standard one, is this possible? It seems that that there is no such API provided to accomplish this, is it possible to use some hooking technique, but this has to be reliable and not to be treated as spyware by anti-virus tools? any other options? If this is not possible, is it possible to add to the spacebar or toolbar in the standard open file dialog a button which invokes my dialog, which allow users select a file and in turn returns the path of the selected file to the "File name" input box of the standard dialog? Any hits, links and code examples will be appreciated.

    Read the article

1 2 3 4  | Next Page >