Tim§id€ Posted April 10, 2009 at 01:42 PM Report #256176 Posted April 10, 2009 at 01:42 PM Boas malta.... 👍 Gostaria que me dessem uma ajuda!= algum sabe se existe no VB algum comando para poder tipo numa inputbox o utilizador introduza a extensão tipo *.MP3 ou *.WMA....e depois vai procurar no Computador todos os ficheiros com essa extensão? ...º(>_<)º...
jpaulino Posted April 10, 2009 at 07:00 PM Report #256218 Posted April 10, 2009 at 07:00 PM Olá, Podes fazer algo do género: Sub ListFiles(ByVal strRootPath As String, ByVal filePattern As String) Try Dim FullDir() As String = IO.Directory.GetDirectories(strRootPath) For Each Dir As String In FullDir Try Dim FullFiles() As String = IO.Directory.GetFiles(Dir, filePattern, IO.SearchOption.AllDirectories) For Each File As String In FullFiles Try ' Mostra qual é o ficheiro Debug.WriteLine(File) Catch ex As Exception End Try Next Catch ex As Exception End Try Next Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call ListFiles("d:\", "*.mp3") ' Se quiseres procurar por mais ficheiros é só copiar End Sub
Tim§id€ Posted April 11, 2009 at 11:07 AM Author Report #256266 Posted April 11, 2009 at 11:07 AM Olá, Podes fazer algo do género: Sub ListFiles(ByVal strRootPath As String, ByVal filePattern As String) Try Dim FullDir() As String = IO.Directory.GetDirectories(strRootPath) For Each Dir As String In FullDir Try Dim FullFiles() As String = IO.Directory.GetFiles(Dir, filePattern, IO.SearchOption.AllDirectories) For Each File As String In FullFiles Try ' Mostra qual é o ficheiro Debug.WriteLine(File) Catch ex As Exception End Try Next Catch ex As Exception End Try Next Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call ListFiles("d:\", "*.mp3") ' Se quiseres procurar por mais ficheiros é só copiar End Sub Obrigado pela ajuda...vou ver se consigo... ...º(>_<)º...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now