PC Review


Reply
Thread Tools Rate Thread

Can SaveFileDialog1 return folder?

 
 
Robert Liles
Guest
Posts: n/a
 
      21st Mar 2005
I want a dialog like SaveFileDialog1 that returns a folder (aka path)
instead of a file name. I have a program that has a file with a file name
already assigned, but I want to allow the user to select the directory to
store it in. Is this possible with a supplied dialog or do I have to create
my own dialog?

Thank you,

Bobbo


 
Reply With Quote
 
 
 
 
Alejandro Lapeyre
Guest
Posts: n/a
 
      21st Mar 2005
I sometimes prefer this dialog instead of the BrowseForFolder, because it
lets you see the files.

Just put whatever you want in the .FileName property, something like "Choose
your folder".
Make shure to set .CheckFileExists = False
Then, extract the pathname from the returned .FileName.

Dim pathname As String
With Me.OpenFileDialog1
.CheckFileExists = False
.CheckPathExists = True
.FileName = "Choose your folder"
If .ShowDialog() = DialogResult.OK Then
pathname = System.IO.Path.GetDirectoryName(.FileName)
End If
End With

Best Regards,
Alejandro Lapeyre

"Robert Liles" <(E-Mail Removed)> escribió en el mensaje
news:1At%d.5638$(E-Mail Removed)...
>I want a dialog like SaveFileDialog1 that returns a folder (aka path)
>instead of a file name. I have a program that has a file with a file name
>already assigned, but I want to allow the user to select the directory to
>store it in. Is this possible with a supplied dialog or do I have to
>create my own dialog?
>
> Thank you,
>
> Bobbo
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      21st Mar 2005
Robert,

From Version 2003 Net1.1 there is the folderbrowserdialog

http://msdn.microsoft.com/library/de...classtopic.asp

Because that there is bug in it. (with paths longer than 128 positions you
can become in trouble) you have to need Net 1.1 SP1 for that.

I hope tis helps,

Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      21st Mar 2005
"Robert Liles" <(E-Mail Removed)> schrieb:
>I want a dialog like SaveFileDialog1 that returns a folder (aka path)
>instead of a file name. I have a program that has a file with a file name
>already assigned, but I want to allow the user to select the directory to
>store it in.


Displaying the dialog for choosing a directory
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=folderbrowserdialog&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
Robert S. Liles
Guest
Posts: n/a
 
      21st Mar 2005
Thank you all, that is just what I needed.
Bobbo


"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Robert Liles" <(E-Mail Removed)> schrieb:
>>I want a dialog like SaveFileDialog1 that returns a folder (aka path)
>>instead of a file name. I have a program that has a file with a file name
>>already assigned, but I want to allow the user to select the directory to
>>store it in.

>
> Displaying the dialog for choosing a directory
> <URL:http://dotnet.mvps.org/dotnet/faqs/?id=folderbrowserdialog&lang=en>
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get Word to return to same folder when inserting? marchman51 Microsoft Word Document Management 1 17th Sep 2009 05:18 PM
Return all files in folder and its' sub folders =?Utf-8?B?QnJhZA==?= Microsoft Access VBA Modules 4 23rd Jul 2007 02:40 PM
Navigate to new email rather than return to folder when deleting? =?Utf-8?B?TWFya1Q=?= Microsoft Outlook Discussion 2 3rd May 2007 07:29 PM
The drafts folder got moved and I can't return it. =?Utf-8?B?S0lNTU8tUkFVVEFQVVJP?= Microsoft Outlook Discussion 1 12th Jan 2005 01:29 AM
Redirected folder can't return to its original place.. straight Microsoft Windows 2000 Active Directory 0 19th Feb 2004 08:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:16 AM.