Results 1 to 10 of 10

Thread: Stupid Question

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6

    Stupid Question

    Okay I know there was a Drive list box in VB6 but I seem to not be able to find one in .NET........is it gone or am I missing something?

    (sorry, bit of a newbie)

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    did you have a look at using the Treeview control - haven't had to do anything like that myself but it seemed to be the most likely control

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6
    Thanks I'll look into that as well.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6
    Okay I found how to list the drives in a combo box but now (remember I'm a newbie learning this on my own) how can I get it to list the files and directories in a listbox I have when someone selects a drive?

    Thanks for you help.

  5. #5
    New Member
    Join Date
    Jan 2001
    Posts
    14
    If you want, you can dig into the VB6 Compatibility Libraries and use the DriveBox / DirBox / FileBox controls.

    Maybe not the best solution, but it worked for one quick and dirty project I had concerning using a Find/Replace routine on filenames...

  6. #6
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    My Visual Basic is a little rusty but couldn't you use an OpenFileDialog for this? It should list all of the drives on the machine, plus if you know the specific drive that you want to query you could set the initial directory.
    Code:
     
    OpenFileDialog1.InitialDirectory = "C:\"
    ' you can also map a filter to the directory if you wanted to. 
    OpenFileDialog..Filter = "TextFiles|*.txt|AllFiles| *.*|ExcelFiles|*.xls"
    OpenFileDialog.FilterIndex = 3
    OpenFileDialog.RestoreDirectory = True
    OpenFileDialog.ShowDialog()

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6
    Thanks all.........I will check these out!

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6
    Okay one last stupid question........where would I go to add the libraries? Is it under the 'Add a reference' option?

  9. #9
    New Member
    Join Date
    Jan 2001
    Posts
    14
    Right-click on your toolbar, pick 'Customize Toolbar', and choose the '.NET Framework Components' tab. They're all there.

  10. #10

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6
    Cool. THanks for helping a n00bie out!

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