-
Jul 25th, 2022, 05:31 PM
#1
Thread Starter
New Member
directory search
I want to know if directory search in a form is usefull when I want to search on my harddisk for pdf files with a specific name that I type in a textbox. And show all the files that he found in another textbox or other.
How I have to do that ? Is there an other way to do that ?
-
Jul 25th, 2022, 09:17 PM
#2
Re: directory search
This is a bizarre question.
Originally Posted by pipopol
I want to know if directory search in a form is usefull when I want to search on my harddisk for pdf files with a specific name that I type in a textbox.
If you want to search for files then yes, searching for files is useful.
Originally Posted by pipopol
How I have to do that ? Is there an other way to do that ?
You want us to show you two different ways?
There's lots of information out there about searching for files already. What have you tried and where are you stuck? We can certainly help but you really ought to make an effort for yourself first. You don't know that you can't do it if you don't try.
-
Jul 26th, 2022, 01:58 AM
#3
Thread Starter
New Member
Re: directory search
Originally Posted by jmcilhinney
This is a bizarre question.
If you want to search for files then yes, searching for files is useful.
You want us to show you two different ways?
There's lots of information out there about searching for files already. What have you tried and where are you stuck? We can certainly help but you really ought to make an effort for yourself first. You don't know that you can't do it if you don't try.
Sure, but it is not really helping me,
first problem : I am 54 years old, and I want just to make one more program, last program I was make is in VB6 about 15 years ago. Its already 3 days I am looking for a solution. I am not in the mood anymore to learn the complete language. I know you are going to say that we are never to old to learn someting, But it's not helping.
second problem : I am not a native speaker or writer in English.
You are my last help that I can get. If not, I let go the program.
-
Jul 26th, 2022, 08:15 AM
#4
Re: directory search
I understand the issues trying to work in a foreign language very well so I have some sympathy with that.
A quick search online found this:
https://docs.microsoft.com/en-us/dot...nd-directories
It does not do exactly what you need it to do but I think you will be able to adapt it very easily with your VB6 knowledge.
If you are still having trouble after you have tried to adapt that code, post back with your issues and someone will be able to help you fix it.
-
Jul 26th, 2022, 06:29 PM
#5
Re: directory search
Hi Pipopol,
Here is an example of how you might go about it. Probably not the best example, but it'll give you the idea.
It's in a .zip file in OneDrive, to run the example, enter the file path of your directory in the textbox and click 'Seek'.
Poppa
Along with the sunshine there has to be a little rain sometime.
-
Jul 27th, 2022, 10:45 AM
#6
Re: directory search
Good luck,
Code:
''' <summary>
''' look for a file
''' </summary>
''' <param name="StartLookingHere">folder to start in. will look in all folders beneath.</param>
''' <param name="FileNameToLookFor">filename to look for. can have wild cards</param>
''' <returns>list of file names</returns>
''' <remarks></remarks>
Private Function LookForFile(StartLookingHere As String,
FileNameToLookFor As String) As List(Of String)
Dim rv As New List(Of String)
Try
rv.AddRange(IO.Directory.GetFiles(StartLookingHere, FileNameToLookFor, IO.SearchOption.TopDirectoryOnly))
Dim ds() As String = IO.Directory.GetDirectories(StartLookingHere)
For Each d As String In ds
Try
rv.AddRange(LookForFile(d, FileNameToLookFor))
Catch ex As Exception
'ignore
End Try
Next
Catch ex As Exception
'ignore
End Try
Return rv
End Function
-
Jul 30th, 2022, 04:20 PM
#7
Thread Starter
New Member
Re: directory search
Thanks Mate, It was helping me a lot. I still changed some things and now its work perfect.
-
Jul 30th, 2022, 09:47 PM
#8
Re: directory search
If your issue is resolved, please use the Thread Tools menu to mark the thread Resolved, so we can see that you need no more help without opening the thread.
-
Jul 31st, 2022, 07:24 PM
#9
Re: directory search
Originally Posted by jmcilhinney
If your issue is resolved, please use the Thread Tools menu to mark the thread Resolved, so we can see that you need no more help without opening the thread.
Hi John,
I did consider sending a similar message to Pipopol myself, although since he / she is new to the forum I'd've explained how to do that in a private message rather than publicly.
I didn't know to which of us his / her last message was addressed to, but then again English isn't his / her first language.
Poppa
Along with the sunshine there has to be a little rain sometime.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|