Open Directory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shaiful
    New Member
    • Oct 2007
    • 89

    Open Directory

    Hi all,
    I am a beginer of VB. I wanna to put a button on my form which will able to do open directory ( not file) from copmuter only, thx a lot for help and idea, Sam
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Try to use DirListBox for the purpose.

    Comment

    • Ali Rizwan
      Banned
      Contributor
      • Aug 2007
      • 931

      #3
      Originally posted by shaiful
      Hi all,
      I am a beginer of VB. I wanna to put a button on my form which will able to do open directory ( not file) from copmuter only, thx a lot for help and idea, Sam
      Hello,
      There ae two options one is to made yourself nd is the old one.
      The second one is the new one and you have seen it when you click open button a open box shows.

      For the first option.

      Add a Drive List Box
      Add a Dir List Box
      Add a File List Box

      Now write the following code

      Code:
      Private Sub Drive1_Change()
      
      Dir1.Path = Drive1.Drive
      
      End Sub
      
      Private Sub Dir1_Change()
      
      File1.Path = Dir1.Path
      
      End Sub
      For the second Option

      Add control Microsoft Common Dialogue Control 6 from components

      Add CommonDialog1
      Add a Command1

      write the following code

      Code:
      Private Sub Command1_Click()
      
      dim a as string
      
      CommonDialog1.ShowOpen
      
      a=CommonDialog1.FileName  ' Saves the filename and path of file you have selected.
      
      End Sub
      GOODLUCK
      ALI

      Comment

      Working...