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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Mad Ape

    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.SaveFileD ialog

    RepDat = New System.Windows. Forms.SaveFileD ialog()

    RepDat.CreatePr ompt = False
    RepDat.Overwrit ePrompt = True
    RepDat.FileName = lblFolder.Text

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

    If RepDat.ShowDial og() = DialogResult.Ca ncel 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
  • =?ISO-8859-1?Q?G=F6ran_Andersson?=

    #2
    Re: How do I get the Name of the current folder from my FileSaveDialog?

    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.GetDirecto ryName method to get the path from the file name.
    >
    Dim RepDat As System.Windows. Forms.SaveFileD ialog
    >
    RepDat = New System.Windows. Forms.SaveFileD ialog()
    >
    RepDat.CreatePr ompt = False
    RepDat.Overwrit ePrompt = True
    RepDat.FileName = lblFolder.Text
    >
    RepDat.Filter = "Access 2K (*.mdb) |*.mdb"
    >
    If RepDat.ShowDial og() = DialogResult.Ca ncel 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
    _____
    Göran Anderssons privata hemsida.

    Comment

    Working...