Click here to Skip to main content
16,010,650 members
Home / Discussions / C#
   

C#

 
GeneralRe: deployment application in VS.Net. Help please Pin
Heath Stewart21-Apr-04 3:51
protectorHeath Stewart21-Apr-04 3:51 
GeneralFolderBrowseDialog problems Pin
WillemM20-Apr-04 21:50
WillemM20-Apr-04 21:50 
GeneralRe: FolderBrowseDialog problems Pin
Anonymous20-Apr-04 22:17
Anonymous20-Apr-04 22:17 
GeneralRe: FolderBrowseDialog problems Pin
WillemM20-Apr-04 22:24
WillemM20-Apr-04 22:24 
GeneralRe: FolderBrowseDialog problems Pin
Anonymous20-Apr-04 22:53
Anonymous20-Apr-04 22:53 
GeneralRe: FolderBrowseDialog problems Pin
Stefan Troschuetz20-Apr-04 23:34
Stefan Troschuetz20-Apr-04 23:34 
GeneralRe: FolderBrowseDialog problems Pin
WillemM20-Apr-04 23:37
WillemM20-Apr-04 23:37 
GeneralRe: FolderBrowseDialog problems Pin
Heath Stewart21-Apr-04 3:59
protectorHeath Stewart21-Apr-04 3:59 
A couple things to add:

When you use ShowDialog to show a modal form, the form/dialog must be disposed. Also, the default for the RootFolder is already the SpecialFolder.Desktop, so you really don't need to set this.

A good way to dispose the dialog when you're done is like so:
using (FolderBrowserDialog dialog = new FolderBrowserDialog())
{
  DialogResult result = dialog.ShowDialog(this);
  if (result == DialogResult.OK)
    somePathVariable = dialog.SelectedPath;
}
This makes sure that the dialog is disposed even if an exception is thrown. If you don't, your memory consumption will continue to increase every time you show this form since the native resources aren't freed since the FolderBrowserDialog uses the SHBrowserForFolder and related native APIs.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: FolderBrowseDialog problems Pin
Stefan Troschuetz21-Apr-04 5:18
Stefan Troschuetz21-Apr-04 5:18 
GeneralRe: FolderBrowseDialog problems Pin
Heath Stewart21-Apr-04 6:50
protectorHeath Stewart21-Apr-04 6:50 
GeneralRe: FolderBrowseDialog problems Pin
Stefan Troschuetz21-Apr-04 8:11
Stefan Troschuetz21-Apr-04 8:11 
GeneralRe: FolderBrowseDialog problems Pin
Heath Stewart21-Apr-04 8:32
protectorHeath Stewart21-Apr-04 8:32 
GeneralGet a string in a Textbox on Cursoposition Pin
Eolus20-Apr-04 21:00
Eolus20-Apr-04 21:00 
GeneralRe: Get a string in a Textbox on Cursoposition Pin
«_Superman_»20-Apr-04 21:14
professional«_Superman_»20-Apr-04 21:14 
GeneralRe: Get a string in a Textbox on Cursoposition Pin
Eolus20-Apr-04 21:43
Eolus20-Apr-04 21:43 
Generala XSD problem Pin
wokankan20-Apr-04 20:59
wokankan20-Apr-04 20:59 
GeneralRe: a XSD problem Pin
wokankan20-Apr-04 21:02
wokankan20-Apr-04 21:02 
GeneralRe: a XSD problem Pin
Heath Stewart21-Apr-04 4:01
protectorHeath Stewart21-Apr-04 4:01 
GeneralClass instantiation question Pin
ecnava20-Apr-04 17:44
ecnava20-Apr-04 17:44 
GeneralRe: Class instantiation question Pin
Roman Rodov20-Apr-04 20:44
Roman Rodov20-Apr-04 20:44 
GeneralRe: Class instantiation question Pin
scadaguy21-Apr-04 3:36
scadaguy21-Apr-04 3:36 
GeneralRetrieve DateTime Pin
Apusnaias20-Apr-04 16:02
Apusnaias20-Apr-04 16:02 
GeneralRe: Retrieve DateTime Pin
Angel Reyes20-Apr-04 18:49
Angel Reyes20-Apr-04 18:49 
GeneralRe: Retrieve DateTime Pin
Apusnaias21-Apr-04 3:01
Apusnaias21-Apr-04 3:01 
GeneralRe: Retrieve DateTime Pin
Heath Stewart21-Apr-04 4:05
protectorHeath Stewart21-Apr-04 4:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.