Populate listview with folders?
welcome to Game-Tuts.com - Register
Results 1 to 7 of 7
  1. #1
    Formerly ELB PRO
    Join Date
    Sep 2010
    Location
    Everywhere
    Age
    16
    Posts
    493
    Thanks
    63

    Default Populate listview with folders?

    Does anyone know how to populate a listview with actual folders, not files? That's all.

    Thanks
    Fast, simple, lightweight and FREE image capture and upload!
    Check out pixldrop.com today!

  2. #2
    Everybody Lies

    Join Date
    May 2009
    Age
    18
    Posts
    3,919
    Thanks
    2364

    Default Re: Populate listview with folders?

    Wouldn't it make more sense to use a treee view? Set the Parent node as the folder and then child nodes as the files. Just loop through the folder and list all the files.


  3. #3
    Formerly ELB PRO
    Join Date
    Sep 2010
    Location
    Everywhere
    Age
    16
    Posts
    493
    Thanks
    63

    Default Re: Populate listview with folders?

    Quote Originally Posted by Brandon View Post
    Wouldn't it make more sense to use a treee view? Set the Parent node as the folder and then child nodes as the files. Just loop through the folder and list all the files.
    Nah, it's not an explorer type deal. I just want to display folders in a listview for something that im doing. I don't need to display individual files at all :P
    Fast, simple, lightweight and FREE image capture and upload!
    Check out pixldrop.com today!

  4. #4
    Sith Lord

    Join Date
    Jul 2010
    Posts
    693
    Thanks
    113
    Gamertag
    Micmou

    Default Re: Populate listview with folders?

    I do not believe you can do this i know you can do files but not folders
    i am not sure
    I am the true Sith one so powerful He snaps his fingers and whole systems die

    don't click this link...



    image host
    Spoiler:

    Read des shit it funny
    Spoiler:



  5. #5
    Everybody Lies

    Join Date
    May 2009
    Age
    18
    Posts
    3,919
    Thanks
    2364

    Default Re: Populate listview with folders?

    Quote Originally Posted by micmou View Post
    I do not believe you can do this i know you can do files but not folders
    i am not sure
    Yeah, you can loop through folders and get their names... lol.

    I don't know if this is right, kinda just made it in np++
    Code:
    FolderBrowserDialog fbd = new FolderBrowserDialog();
    if (fbd.ShowDialog() == DialogResult.OK) {
        DirectoryInfo di = new DirectoryInfo(fbd.SelectedPath);
        foreach (System.IO.DirectoryInfo folders in di.GetDirectories()) {
             listview.Items.Add(folders.Name);
        }
    }


  6. The Following User Says Thank You to Brandon For This Useful Post:

    Smart (08-12-2012)

  7. #6
    Formerly ELB PRO
    Join Date
    Sep 2010
    Location
    Everywhere
    Age
    16
    Posts
    493
    Thanks
    63

    Default Re: Populate listview with folders?

    Quote Originally Posted by Brandon View Post
    Yeah, you can loop through folders and get their names... lol


    I don't know if this is right, kinda just made it in np++
    Code:
    FolderBrowserDialog fbd = new FolderBrowserDialog();
    if (fbd.ShowDialog() == DialogResult.OK) {
        DirectoryInfo di = new DirectoryInfo(fbd.SelectedPath);
        foreach (System.IO.DirectoryInfo folders in di.GetDirectories()) {
             listview.Items.Add(folders.Name);
        }
    }
    Thanks baby <3
    Fast, simple, lightweight and FREE image capture and upload!
    Check out pixldrop.com today!

  8. #7
    Shenanigans


    Join Date
    May 2009
    Location
    Local host
    Age
    20
    Posts
    3,451
    Thanks
    1996

    Default Re: Populate listview with folders?

    Quote Originally Posted by micmou View Post
    I do not believe you can do this i know you can do files but not folders
    i am not sure


    Quote Originally Posted by Brandon View Post
    Yeah, you can loop through folders and get their names... lol.

    I don't know if this is right, kinda just made it in np++
    Code:
    FolderBrowserDialog fbd = new FolderBrowserDialog();
    if (fbd.ShowDialog() == DialogResult.OK) {
        DirectoryInfo di = new DirectoryInfo(fbd.SelectedPath);
        foreach (System.IO.DirectoryInfo folders in di.GetDirectories()) {
             listview.Items.Add(folders.Name);
        }
    }
    Looks right to me

  9. The Following User Says Thank You to abis24 For This Useful Post:

    Smart (08-13-2012)


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
visit GameTuts on these social networking sites