473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How do I get the Name of the current folder from my FileSave Dialog?

Hello

I have a FileSave Dialog and am trying to pass the current folder name
to a string. Is there any way to do that? It was easy to get the file
path and name using .FileName but I see nothing to get the Folder.

Thanks

The Mad Ape
Dim RepDat As System.Windows.Forms.SaveFileDialog

RepDat = New System.Windows.Forms.SaveFileDialog()

RepDat.CreatePrompt = False
RepDat.OverwritePrompt = True
RepDat.FileName = lblFolder.Text

RepDat.Filter = "Access 2K (*.mdb) |*.mdb"

If RepDat.ShowDialog() = DialogResult.Cancel Then
Exit Sub
End If

Dim strFi As String = RepDat.FileName.ToString 'returns file
name

Dim strDir As String = 'what do I type here to get the current
folder?

RepDat.Dispose()
RepDat = Nothing
Jul 11 '08 #1
1 1419
The Mad Ape wrote:
Hello

I have a FileSave Dialog and am trying to pass the current folder name
to a string. Is there any way to do that? It was easy to get the file
path and name using .FileName but I see nothing to get the Folder.

Thanks

The Mad Ape
Use the Path.GetDirectoryName method to get the path from the file name.
>
Dim RepDat As System.Windows.Forms.SaveFileDialog

RepDat = New System.Windows.Forms.SaveFileDialog()

RepDat.CreatePrompt = False
RepDat.OverwritePrompt = True
RepDat.FileName = lblFolder.Text

RepDat.Filter = "Access 2K (*.mdb) |*.mdb"

If RepDat.ShowDialog() = DialogResult.Cancel Then
Exit Sub
Oops! If you exit here, you don't dispose the dialog.
End If

Dim strFi As String = RepDat.FileName.ToString 'returns file
name

Dim strDir As String = 'what do I type here to get the current
folder?

RepDat.Dispose()
RepDat = Nothing

--
Göran Andersson
_____
http://www.guffa.com
Jul 11 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
8
by: Salad | last post by:
I designed a small app and I wanted to do a BrowseFolder (see http://www.mvps.org/access/api/api0002.htm), basically do a file open diaglog and select a directory/folder. The problem is that you...
3
by: Alur | last post by:
Changing the current directory with the help of dialog window(MFC app) We can change directory with the help of the following code: CFileDialog m_ldFile(TRUE);...
0
by: Steve E. | last post by:
Hello, Similar to the post below, can you advise what I can do so "aspx" isn't appended when saving a file in Netscape 7? Big thanks in advance for tolerating a Netscape-related question - I'm...
0
by: Bryan Ax | last post by:
Every time I've worked with saving files from the web, I have always used code like the following to force a save dialog where a consumer can choose to open or save the file. string fileName =...
5
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a...
0
by: John Hunter | last post by:
The following behavior surprised me. I have a Tk window and launch a file save dialog from it. When the filesave dialog is finished, it calls callbacks bound to the destroy event on the main...
2
by: biganthony via AccessMonster.com | last post by:
I have inherited a small DB in my office and was wondering if someone could provide some advice. Currently the DB allows the office manager to archive the data for each year under the DB's program...
14
by: pamela fluente | last post by:
I want to use the ordinary OpenFileDialog to choose a folder instead of a file. Is it possible? And how? -P
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.