Results 1 to 7 of 7

Thread: [RESOLVED] DirList - select option

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    15

    Resolved [RESOLVED] DirList - select option

    Hi

    I have a wee app that has a DirList box, a command button and a ListView - basically I select a folder click the button and it's added to a list. This works ok but I'm trying to get a way to have the folder selected without having to open it in the Dirlist (ie it's selected if highlighted) - not sure if it's possible or not.

    Cheers in advance

    Neil
    Last edited by the_jinj; Oct 3rd, 2005 at 04:26 AM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: DirList - select option

    You can add anything you want to a listbox, it doesn't have to be loaded from a DirList. Just use something like this:
    VB Code:
    1. List1.Additem "C:\temp"

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    15

    Re: DirList - select option

    Sorry maybe I never explained clearly...I want to be able to know what folder the user has clicked on even if it's just highlighted in the DirList box - at the moment it has to be double clicked to open it before it registers what directory was selected.

  4. #4
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: DirList - select option

    VB Code:
    1. Private Sub Command1_Click()
    2.   With Dir1
    3.     Text1.Text = .List(.ListIndex)
    4.   End With
    5. End Sub
    This world is not my home. I'm just passing through.

  5. #5
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: DirList - select option

    Quote Originally Posted by the_jinj
    able to know what folder the user has clicked on even if it's just highlighted in the DirList box
    Extending trisuglow's example in the Click event (works):
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Dir1_Click()
    4.     Me.Caption = Dir1.List(Dir1.ListIndex)
    5. End Sub

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    15

    Re: DirList - select option

    Quote Originally Posted by trisuglow
    VB Code:
    1. Private Sub Command1_Click()
    2.   With Dir1
    3.     Text1.Text = .List(.ListIndex)
    4.   End With
    5. End Sub
    That worked perfectly - thanks !

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    15

    Re: DirList - select option

    Quote Originally Posted by Bruce Fox
    Extending trisuglow's example in the Click event (works):
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Dir1_Click()
    4.     Me.Caption = Dir1.List(Dir1.ListIndex)
    5. End Sub
    That works too...thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width