[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB.Net SaveFileDialog

Posted on 2014-07-15
4
Medium Priority
?
732 Views
Last Modified: 2014-07-20
In VB.Net 2008

Using SavefileDialog as you select the Directory and folder can you show the path in the file name: text
if so how

Thanks
0
Comment
Question by:Kevinfeening
  • 2
4 Comments
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 40198549
Could you clarify your question?
The property Filename contains both the  file path and extension.
e.g. A filename value could be:
c:\temp\myfilename.txt
if you need only the file name not the path use Path.GetFilename method:
Path.GetFilename("c:\temp\myfilename.txt")
This method returns myfilename.txt

For other path methods and code samples on how to extract only parts of your file path, check:
http://www.dotnetperls.com/path-vbnet
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40199269
You cannot (easily) change the behaviour of built in dialog boxes and as far as I know, there isn't an option to enable this behaviour.
0
 

Author Comment

by:Kevinfeening
ID: 40200521
The property filename is empty
I want when the user clicks on the directory etc it to populate the savefileDialog.filename
0
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 total points
ID: 40200810
If you require to select a directory, then you need to use property SelectedPath  from FolderBrowserDialog

Code snippet from MSDN:
Dim result As DialogResult = folderBrowserDialog1.ShowDialog() 
If ( result = DialogResult.OK ) Then
           folderName = folderBrowserDialog1.SelectedPath 
           ' this sample assign selected directory to open a file dialog but you can replace with save dialog as well 
            If (not fileOpened) Then 
                ' No file is opened, bring up openFileDialog in selected path.
                openFileDialog1.InitialDirectory = folderName 
                openFileDialog1.FileName = nothing
                openMenuItem.PerformClick() 
            End If 
End If 

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question