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 6668027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:59:44+00:00 2026-05-26T02:59:44+00:00

The FolderBrowserDialog component in .NET Framework (and the OpenFileDialog ) implements the IDisposible interface,

  • 0

The FolderBrowserDialog component in .NET Framework (and the OpenFileDialog) implements the IDisposible interface, meaning we should call its Dispose method at some appropriate time after we’ve done with it or something bad happens (unmanaged resource leaks).

In Visual Studio WinForm designer, if I drag a FolderBrowserDialog component onto a Form, the code generated by the designer does not seem to take care of this at all, no code calls the Dispose method on the FolderBrowserDialog.

In contrast, if I drag a Timer (the one in the System.Windows.Forms namespace) which also implements IDisposible interface, the code generated would be:

this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);

By associating the timer with the container (this.components), the timer is guaranteed to be properly disposed when the container is disposed- happens when Form.Close() or Form.Dispose() is called.

So why FolderBrowserDialog component receives this special treatment?

  • 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-26T02:59:45+00:00Added an answer on May 26, 2026 at 2:59 am

    Good spot! The reason is probably that the FolderBrowserDialog does not provide a constructor that takes an IContainer argument, whereas Timer does.

    As to why this is so, you can only ask the original winforms designers. Maybe it isn’t really designed to be used in the designer in this way? They only meant it to be used in code in a using statement?

    Bear in mind that FolderBrowserDialog, and its parents, don’t actually override Dispose from Component, so it doesn’t actually need to dispose anything.

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

Sidebar

Related Questions

there is a folderbrowserdialog control in winform but not in asp.net is there anyway
Whenever I call folderbrowserdialog.showDialog() my application crashes. I'm using the code that worked before
I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I
This seems odd to me. I'm using FolderBrowserDialog to select a folder which will
I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in
I'm facing problem in showing FolderBrowserDialog instance created and called from a non-UI thread.
I have seen that there is a folderBrowserDialog but couldn't see one for files
In my Windows Form's Form_Load event, I want to show a FolderBrowserDialog to let
I need to create a user control in C#.Net, which can be added to
I need to return a string from a button method .How can i do

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.