Yeah, I knew how to hash it out, but thought there'd be a more elegant
solution.
Here's some code that wound up working:
Dim folderPrefix As String
Dim tempDirectory As System.IO.DirectoryInfo = New
System.IO.DirectoryInfo(FolderBrowserDialog1.Selec tedPath)
If tempDirectory.GetDirectories().Length > 0 Then
WorkbookName_text.Text = folderPrefix & " " &
Trim(Str(Math.Abs(tempDirectory.GetFiles("*.xls"). Length + 1)))
Else
WorkbookName_text.Text = String.Empty
End If
Thanks though!
Randall
"Atul" wrote:
Search for the first Path.DirectorySeparatorChar value from the end of the
folder string. The selected folder name is the substring from that position
to the end.
You might also want to take a look at FolderView Control at
http://www.ssware.com/fldrview.htm which provides easy access to such
information.
-Atul
http://www.ssware.com/
Shell MegaPack - Windows Explorer Shell Controls for ActiveX and .Net
"Randall Arnold" <Ra***********@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...I thought this would be a simple one but I can't quite figure it out.
I'm using the FolderBrowserDialog to select a path for file saving. Every
time the user changes the path, I want to grab the very last folder in
that
path because it's used to generate automatic default file names. I'm
trying
to find a built-in method for doing this but haven't found one. I thought
I'd find the answer in System.IO but can't quite seem to. I need
something
analogous to GetRootFolder only I just need the last folder in the chain.
Anyway ideas? Thanks in advance.