Obtain path to save a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • monu121
    New Member
    • Jun 2007
    • 16

    #1

    Obtain path to save a file

    Hi,
    I am working on VB 6.0 and I want to create a browse button to which when I will click then I will get the storage path to where I want to save my generate file.
    So please help me.

    Thanks & Regards
    monu
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by monu121
    Hi,
    I am working on VB 6.0 and I want to create a browse button to which when I will click then I will get the storage path to where I want to save my generate file.
    So please help me.

    Thanks & Regards
    monu

    i think you mean file dialog control...

    is it?

    Comment

    • hariharanmca
      Top Contributor
      • Dec 2006
      • 1977

      #3
      Originally posted by monu121
      Hi,
      I am working on VB 6.0 and I want to create a browse button to which when I will click then I will get the storage path to where I want to save my generate file.
      So please help me.

      Thanks & Regards
      monu
      monu121 don't double post your thread. Okay...

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by monu121
        I am working on VB 6.0 and I want to create a browse button to which when I will click then I will get the storage path to where I want to save my generate file.
        Sounds as though you're looking for the Microsoft Common Dialog Control. Look it up in the doco.

        Comment

        • deaddog4201
          New Member
          • Jun 2007
          • 9

          #5
          Something like this should work for you. You'll need to figure how you'll implement it into your code and change the file filter options to suit your needs! You'll also need to have a textbox on your form named txtsetfile and a button named btnBrowse or change the code to suit your needs! No one answers me here so I hope this helps you out!

          [CODE=vbnet]

          Public selectFile As String
          Public setfilePath As String

          Private Sub btnBrowse_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnBrowse.Click
          Setfile()
          txtsetfile.Text = setfilePath & "\" & selectFile
          End Sub

          Public Sub Setfile()
          Dim selectFileLocat e As New OpenFileDialog
          selectFileLocat e .Filter = "Executable (*.exe)|*.exe"
          selectFileLocat e .Title = "Select file"
          selectFileLocat e .InitialDirecto ry = "C:\"
          selectFileLocat e .CheckFileExist s = True
          selectFileLocat e .CheckPathExist s = True
          Select Case selectFileLocat e .ShowDialog()
          Case DialogResult.OK
          selectFile= IO.Path.GetFile Name(selectFile Locate.FileName )
          selectFilePath = IO.Path.GetDire ctoryName(selec tFileLocate.Fil eName)
          Case DialogResult.Ca ncel
          End Select
          selectFileLocat e.Dispose()
          End Sub

          [/CODE]

          Comment

          Working...