Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8960843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:45:02+00:00 2026-06-15T15:45:02+00:00

I have a C# .NET 3.5 program that uses an OpenFileDialog to retrieve a

  • 0

I have a C# .NET 3.5 program that uses an OpenFileDialog to retrieve a file for importing. It has two filters (*Domain*.* and *.*) and the *Domain*.* is chosen as the FilterIndex. I’m seeing a case of a disappearing file from the filters when it is modified within the OpenFileDialog.

Here are the steps the user will take to reproduce the problem:

  1. In the program, open the OpenFileDialog. Ensure that the filter is set to *Domain*.*.
  2. Find a file in the directory that matches the filter and change the file name so that it no longer matches the filter. Note: the file will disappear.
  3. Change the filter to show all files *.*. Note: the file is not listed even though you’re supposedly showing *.*.

At this point, you can open the folder in Windows Explorer and see that the file with the changed name exists. However, in the OpenFileDialog, it is no longer visible regardless of the filter that is used. The only way to see that file again is to close the OpenFileDialog and then reopen it.

Here is my code that creates the OpenFileDialog.

using(OpenFileDialog domainFileDialog = new OpenFileDialog())
{
    domainFileDialog.CheckFileExists = true;
    domainFileDialog.CheckPathExists = true;
    domainFileDialog.Filter = "Domain Files (*Domain*.*)|*Domain*.*|All files (*.*)|*.*";
    domainFileDialog.FilterIndex = 1;
    domainFileDialog.Multiselect = false;
    domainFileDialog.RestoreDirectory = true;
    domainFileDialog.ShowReadOnly = true;
    domainFileDialog.SupportMultiDottedExtensions = true;
    domainFileDialog.Title = "Choose the Domain File to Import...";
    domainFileDialog.ValidateNames = true;

    \\ Perform Import functionality...
}

It seems as though when you open the OpenFileDialog and modify an existing file that matches the more restrictive filter so that it no longer matches the filter, the file disappears from visibility even when all files *.* are displayed.

Since I have no idea why this is happening, (and I’m open for suggestions as to how to fix it) is there any way to restrict a user from creating or modifying any of the files in the OpenFileDialog in hopes of preventing this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:45:03+00:00Added an answer on June 15, 2026 at 3:45 pm

    First, I’d suggest you consider whether it is worth caring that the user might do this. If the FOD does this, every windows application has this feature, but you don’t hear users complaining about it. So is it really an issue that needs fixing?

    It wouldn’t surprise me if the problem’s related to the filter being for more than just a file extension – it’s rather unconventional to do this. Maybe try it with an extension only and see if this is the cause.

    Have you tried pressing F5 to refresh its cached data? I don’t know if this would work in a FOD as it does in an explorer window, but it might be interesting to give it a try.

    Having said all that, it would be trivial to filter keypresses (F2) and mouse clicks (right button) )(with some forms you could derive off it, or you could drop in a MessageFilter) to make it impossible for a user to access any UI that allows them to rename a file in the FOD. It would piss me off, as a user, if you broke the FOD in this waym though – much more than a renamed file “disappearing” under rare circumstances, anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program written in VB.NET which stops a service that uses file
I have a vb.net program that uses mysql as its database. And it works
I have a program written in VB.Net (Visual Studio 2008) that uses a DLL
I have a .NET 2.0 program that has a reference to Interop.WIA.dll (.NET), which
I have a program using WPF in C# that uses the .NET 4 Framework
I have a program that uses the Now.ToFileTime() function in .NET to get a
We have a .NET program that uses WCF to listen for communication from another
I am using vb.net 2010 and I have created a program that uses sockets
I have a program that uses the libexif C library found here http://libexif.sourceforge.net/ I
I have a C# program that uses .NET 2.0 Local Report Rendering to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.