Loading Files Into a Listview

Im curently working on a program in Visual Basics 2005 and Im trying to make it so that when I press a button a Folder Dialog Box opens and then the folder I choose lists the files in there with a certain filter. Heres what i got so far

Private Sub Button42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button42.Click

Dim lpf As New FolderBrowserDialog

If lpf.ShowDialog = Windows.Forms.DialogResult.OK Then

End If

End Sub



Answer this question

Loading Files Into a Listview

  • DaweiHuang

    Basicly what im doing is incorparating a windows media player into my app. I want to know how to add files from a certain folder that have the ext. (.mpeg, .mpg, .mp3, .wma and .avi) to a listview, then the selected item is able to be played in the windows media player. So far I have the windows media player in my program and the listview.

    Also if this helps any, I can get the windows media player to play files fine.

    And another question, How do i make a multiple file filter for a ofd, So if the "All suported files" Filter was selected, It would show these files (mpeg, .mpg, .mp3, .wma and .avi).

    Thanx in advance.


  • jason R S

    Yes, Thats exactly what I needed. Thank you so much.
  • DaveWadd

    hi,

    so what's the questoin , at the top of this forum there is "how to get optimal answer" thread read it plz

    best regards



  • Brian Keller

    hi,

    1- about the list view it consists of one column or more , like the datatable you build those columns first then if its one column you fill this table by items , if its more columns like song , length , date then you have to add subitems for those detail cells

    you can find how to here http://msdn2.microsoft.com/en-us/library/6dwb14tw.aspx

    2- setting ofd filter

    to set dialog filters you do that in paires, lets say you want to open a text files so the filter will follow this format

    "string appear to user | *.file extention ; *.another file extention if needed"

    so in text files it will be "plain text | *.txt"

    in webpages it will be "webpages | *.htm;*.html;*.asp;*.aspx"

    if you want to have 2 filters you simply add both of them splited by "|" like this

    "webpages | *.htm;*.html;*.asp;*.aspx | plain text |*.txt"

    if you want to add more filter pairs you can just split them with this charachter "|"

    "webpages | *.htm;*.html;*.asp;*.aspx|plain text |*.txt | MsWord | *.doc"

    hope this helps



  • Loading Files Into a Listview