473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Searching a directory for a file

I'm trying to create a program so when you click a button there will be a search on the word typed into the text box and it will search in the selected drive. If you could tell me what that function or member is, or tell me how to do it, I would appreciate it.
Mar 22 '07 #1
9 1399
Killer42
8,435 Expert 8TB
I'm trying to create a program so when you click a button there will be a search on the word typed into the text box and it will search in the selected drive. If you could tell me what that function or member is, or tell me how to do it, I would appreciate it.
Which part are you seeking help with? We're here to help with specific problems, but you need to give it a shot and let us know which part of the code is giving you trouble.
Mar 23 '07 #2
Which part are you seeking help with? We're here to help with specific problems, but you need to give it a shot and let us know which part of the code is giving you trouble.
Ok, what I have is, you can select the drive that you want, and I can get the "Search" button to read which directory I selected, but I want to know if there is actually a function or method for search, so it will search for what is entered in TextBox2 on the selected drive when the "search" button is clicked and display the results in a ListBox.
Mar 23 '07 #3
Killer42
8,435 Expert 8TB
Ok, what I have is, you can select the drive that you want, and I can get the "Search" button to read which directory I selected, but I want to know if there is actually a function or method for search, so it will search for what is entered in TextBox2 on the selected drive when the "search" button is clicked and display the results in a ListBox.
I don't think so. As far as I know, you'll have to (very carefully) open and read each file. Unless there's some sort of Google toolkit or something that you can invoke.
Mar 24 '07 #4
SammyB
807 Expert 512MB
Ok, what I have is, you can select the drive that you want, and I can get the "Search" button to read which directory I selected, but I want to know if there is actually a function or method for search, so it will search for what is entered in TextBox2 on the selected drive when the "search" button is clicked and display the results in a ListBox.
If you are using VB.NET, then you use Directory.GetFiles
See http://msdn2.microsoft.com/en-us/library/wz42302f.aspx.

If you are using VBA, then you use Dir or Application.FileSearch.

If you are using VB6, then if I remember you also use Dir.
Mar 24 '07 #5
Killer42
8,435 Expert 8TB
If you are using VB.NET, then you use Directory.GetFiles
If you are using VBA, then you use Dir or Application.FileSearch.
If you are using VB6, then if I remember you also use Dir.
I think the idea was to search within the files for a string.
Mar 25 '07 #6
Well actually I have gotten my program to the point where it will attempt to search for the file I type into the textbox but the a security error comes up saying, access to ... is denied. I tried typing in "On Error Resume Next" but then nothing gets displayed at all, it just keeps on looping.
Mar 31 '07 #7
r035198x
13,262 8TB
Thread renamed .
Mar 31 '07 #8
Killer42
8,435 Expert 8TB
Well actually I have gotten my program to the point where it will attempt to search for the file I type into the textbox but the a security error comes up saying, access to ... is denied. I tried typing in "On Error Resume Next" but then nothing gets displayed at all, it just keeps on looping.
Are you trying to open the files, or just find them by name?
Mar 31 '07 #9
Are you trying to open the files, or just find them by name?
Well for now im trying to be able to pick a directory and then search for a file within it and eventually i will want to be able to open it and run it.
Jun 1 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John | last post by:
Hi everyone ! This is a first time I post a message here. If I post my message in a wrong group. Please ignore it. I am trying to build a website which allows users (can be thousands of...
4
by: James | last post by:
We have a need to search through an entire drive for a specific file name. The process is currently written with recursive loops through each directory and the Scripting.FileSystemObject. Problem...
1
by: trialproduct2004 | last post by:
Hi all, I am having C# application which is accepting file name and directory name. What i want is to check whether file present in given directory or not. Directory can have sudirectories...
29
by: jaysherby | last post by:
I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. Can...
1
by: Psapg | last post by:
Hi! I'm new to javasript, and i must confess to have borowed a few free scripts from the net to satisfie my needs.... Still i can't find even an idea of ascipt to do this... Please Help!!! ...
2
by: neilio2j | last post by:
hi, can anyone tell me how to search a given directory using C++? so far i have been successful in searching a file named, for tags"h:\\tags.cpp", whereas i would like to search for all files...
1
by: Timothy | last post by:
Hi All, Please everyone this is my humble request to all of you if you please have idea about my question then please help me with your master ideas. I have requirement that i should either have...
5
by: peruron | last post by:
Hello again! I've been discussing the advantages of Python over C-Shell. I was asked if I can replace the use of "grep" in searching for a specific string in a multi-file directory - I have to go...
4
by: jodleren | last post by:
Hi! I wonder, which way to do this fastest. I have a disk, where I need to search for a file or directory. I do it recursively, meaning that I start from the top dir, then I add all...
2
Markus
by: Markus | last post by:
I'm trying to search through a specified file path (C:\\Users\<name>) and then delete specified file types. The code below works, but it only goes 1 sub-directory deep. Does anyone know how I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.