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

  • Home
  • SEARCH
  • 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 793733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:12:00+00:00 2026-05-14T22:12:00+00:00

Say I wanted to customize an OpenFileDialog and change, for example, the way the

  • 0

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!

  • 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-05-14T22:12:01+00:00Added an answer on May 14, 2026 at 10:12 pm

    Nested type is just another way of saying wrapper class (I am assuming). So you would create a new class that has a private member class of OpenFileDialog. Then you create all of the public members that you need.

    So for OpenFileDialog you would create a class like this:

    public class CustDialog
    {
       private OpenFileDialog _dialog;
    
       public CustDialog()
       {
           //instantiate custom OpenFileDialog here
       }
    
       public DialogResult ShowDialog()
       {
           return _dialog.ShowDialog();
       }
    }
    

    You can even take this one step further and have the wrapper class inherit from the CommonDialog class. This would allow you to use your wrapper class exactly like a standard dialog.

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

Sidebar

Related Questions

Say I wanted to change the font of certain folders in Windows Explorer programatically,
Say I wanted to have a project, and one-to-many with to-do items, and wanted
Say I wanted to have the first six characters in black and the next
Say I wanted to have one variable in a class always be in some
Say I wanted to write a program that would export calendar data so that
Say I wanted to print a ÿ (latin small y with diaeresis) from its
Say I wanted to display the number 123 with a variable number of padded
I've been searching and found jFreeChart , Python Google Chart and matplotlib . Searching
Are there any good reasons why I should not use XIB / NIB files

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.