Searching Through CSV Files
hi there i have a csv file with 2 colums namely <uid>,<accessid>
now on my vb form i ask user to enter the uid i want to check this uid against all the uid records in the csv file and get for myself the accessid
can any1 help me code this
i can write csv files .. but never tried to search thru one be4.. if someone can help me with this code...it will be most appreciable.. thnx a lot
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Searching Through Files
I can't find some code to do this, but i want to search through text files under 50kb and if they contain certain words (on their own or mixed eg. sfkfekHAPPYBIRTHDAYnfkfjiodfj) and then copy them to the C: drive (or a drive if possible)
ANy Ideas? I would be gratefull.
Searching Txt Files
Hi,
I am making a Video Store Rental program for a project. Attached is my txt file with over 2000 movies and there status. What I want to do is havce a textbox and have the user able to enter a movie they want(even if they spell the title wrong or just enter one word) and display the results in order. However, Im not sure how to search the file to get this informaiton. Can anyone please guide me?
Thanks
Searching Files
if i have the computername and the workgroupname can i use Dir$() to search his computer for files ?
Searching For Files
ok this ones more difficult...
this game i have, theres the option to install it on the menu. what i want is also a 'play' button that runs the games .exe file after installation.
however, i want the play button to be disabled if the game is not installed, so i need to search for Game.exe to make sure its in the install directory before you can run it
also, if the game is not installed in the default directory how do i find out where it is?
Searching For Files
Hi Guys,
I have a small question... i'm not too sure how i'm to approach this... so i need someone to tell me what to do...
I need to find a file on a specified directory and i need to exectue the file at the same time...
Take for instance Test.txt... it's in this directory and i need to find this file and execute it automatically the minute i open the directory... how do i get this done...
Thanks in advance...
~JohN~
Searching For Files
Hey there,
I just have one question, does anyone out there know the command on how to seach a for example ".pdf" file within a directory...
Thank you for you coorperation
have a nice day!
Searching Files
Hey, I'm searching a directory of about 215 files. I need to get to the file's properties and see exactly what that file is. I'm using DSOFile to do this. But by doing this, I have to grab and open every single file to read it's properties and do my operations on it if I have to. This takes about 15 seconds to do. Is there any faster way of doing this? I did speed the search up to about 5 seconds by specifying which file names to search for but it gets more complicated than this and I can not do it that way. I'm stuck on how to get to the easiest solution. If there isn't a faster search than using DSOFile and searching each file then my program will probably become gigantic. Anyone want to help out and talk to me about this?
Searching Certain Files
if i am using this line with a commondialog.
.Filter = "Wave files (*.wav)|*.wav"
how would i make it look for mp3 and wav.
thanks
thingimijig.
Searching .dat Files
I was wondering if it was possible in VB6 to search a folder full of .dat files for a specific word in a .dat file? For instance, would I be able to make a program that searches for the word 'wire' in all of the .dat files in a folder then return a list of the files that contain the word?
Searching For Files
Hi there,
Before you hang me,I have been through the posts in this board but I either don't have the options or commands to select eg FileSearchObject,..etc
Or I just don't understand.
I am trying to get my vb program to look for a particular file, but not setting a path.
this vb program is run/called by an install program, so users will not be asked to select any paths.
Would anyone know if there is a function like Dir(), that would just let me put my file name then it will just give me a path
Trivial info :I currently use Office 97 with this program
The install program is Wise for Windows Installer
My apologies if this is too vague. I can provide more details if necessary.
And thanks for taking your time to look at my query.
Searching For Files
VB Code:
Dim searchvar As StringDim sbookmark As String searchvar = InputBox("Please Enter the Instrument Number to be Searched") searchvar = Trim$(searchvar) If searchvar <> "" Then With Data1.Recordset sbookmark = .Bookmark .FindFirst "InstrumenNumber like '" + searchvar + "*'" If .NoMatch Then MsgBox "not found" .Bookmark = sbookmark End IfEnd WithEnd If
This code allows me to find any file provided the first word of the file name is the same as the word i inputted.
However, what if i wanted to match any word in the file name, with the word i inputted. What would be the code then?
Any Help would be appreciated.
Searching Files
Hello,
Have a cmd-button on a form. If I click on it I want the program to search for a file (let's call it test.txt) on my harddisk.
1. How can I do this?
2. How can I do this if the file packed in a .zip (or .rar, .cab) file?
Many thx for helping me...
DrLector
Searching For Files
With a set path to a certant folder, how to I scan for all files within that directory without the use of any object.
Searching Files
I'm trying to search about 32 subdirectories for a match with Text1.text with a Command1_Click. I need some help searching subdirectories.
Any Help?
JO
Searching Files!
hi!
i am having trouble using vb6 for searching files in a directory.the code that i am writing is :
Quote:
Private Sub new_Click()
Dim name_of_file As String
name_of_file = InputBox("Enter name: ", "New File", , Width / 2, Height / 2)
If Dir$("c:VB files*.txt") = name_of_file & ".txt" Then
MsgBox ("File already exists")
Else
MsgBox ("No file found")
End If
End Sub
in the folder VB files i have the following files:
1.me.txt
2.james.txt
3.keith.txt
but when running the program,the message "File already exist" is being displayed ONLY when name_of_file is james.why?what is the solution pls?
i even arranged the if statement as :
Quote:
If Dir$("c:VB files") = name_of_file & ".txt" Then
MsgBox ("File already exists")
but it was useless.
what am i doing wrong?my aim is to search for existing files-and it is seriously making me mad
THANK YOU!
Searching Files
hi!
i am having trouble using vb6 for searching files in a directory.the code that i am writing is :
Quote:
Private Sub new_Click()
Dim name_of_file As String
name_of_file = InputBox("Enter name: ", "New File", , Width / 2, Height / 2)
If Dir$("c:VB files*.txt") = name_of_file & ".txt" Then
MsgBox ("File already exists")
Else
MsgBox ("No file found")
End If
End Sub
in the folder VB files i have the following files:
1.me.txt
2.james.txt
3.keith.txt
but when running the program,the message "File already exist" is being displayed ONLY when name_of_file is james.why?what is the solution pls?
i even arranged the if statement as :
Quote:
If Dir$("c:VB files") = name_of_file & ".txt" Then
MsgBox ("File already exists")
but it was useless.
what am i doing wrong?my aim is to search for existing files-and it is seriously making me mad
THANK YOU!
Searching For Files
I save some pdf files in the temp directory to be used in a program and would like to delete the files before I exit from the program. If the files in the tmp folder are say, Bug0122.pdf, Bug0123.pdf, Bug 0144.pdf, Bug 0233.pdf; I would like to see if the files starting with Bug01*.pdf exists or not. I just came to know that FileSystemObject.fileexits searches for just the exact match and not for a group of files. Is there any way I could search of these files.
Thanks.
Searching Files!
Hi, I am having a problem searching specific documents for strings. I've been using the InStr() builtin function and the program isn't working. Here is the code....
Code:
Private Function searchNow(varFound As String)
Dim inti As Integer
If (chkCase.Value = False And InStr(LCase(varFound), LCase(txt1.Text))) _
Or (chkCase.Value = True And InStr(varFound, txt1.Text)) Then
createList (varFound)
Else
If LCase(Right(varFound, 3)) = "rtf" Then
searchStuff varFound, "rtf"
ElseIf LCase(Right(varFound, 3)) = "doc" Then
searchStuff varFound, "doc"
End If
End If
End Function
'Search the actual files for the string
Private Function searchStuff(ByVal varFound As String, ByVal docType As String)
Dim iFile As Long
Dim strFile As String
Dim intj As Integer
stbFiles.Panels.Item(1).Text = varFound
If docType = "doc" Then
bolDoc = True
strLine = ""
For intj = 1 To Len(varFound)
strLine = Right(varFound, intj)
If InStr(strLine, "") Then intj = Len(varFound) + 1
Next intj
ChDir Left(varFound, Len(varFound) - (Len(strLine) - 1))
RunProcess "Stripall " & Right(strLine, Len(strLine) - 1)
varFound = Left(varFound, Len(varFound) - 3) & "out"
colChanged.Add varFound
End If
iFile = FreeFile
strLine = ""
Open varFound For Input As #iFile
Do Until EOF(iFile)
Line Input #iFile, strLine
If (chkCase.Value = Checked And InStr(1, txt1.Text, strLine)) Or _
(InStr(1, LCase(txt1.Text), LCase(strLine)) And chkCase.Value = Unchecked) Then
If LCase(Right(varFound, 3)) = "out" Then varFound = Left(varFound, Len(varFound) - 3) & "doc"
createList (varFound)
GoTo endLoop
End If
Loop
endLoop:
Close #iFile
If ProgressBar1.Value < ProgressBar1.Max Then
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Function
the stripall program strips characters from the document with however it is programmed...pretty simple just runs the ascii code and if the code isn't one thats allowed it's removed.
but i have set it to only do this for word documents because MS puts excess crap in them. The output file is a text type file with the extension .out
ok now the problem:
When i click find it calls searchnow, the issue is that search stuff puts all the documents it finds into the list. But then if i have a document with the title equal to the document the program crashes...
any help is definately a plus
thanks in advance
- nc
Searching PDF Files
Is there some way to use Adobe Acrobat or anything search for text in PDF Files using VB?? I have gotten my program to open the index and search but I can't get to the results because they are in a seperate window. I am trying to just make a site search and I have about a hundred PDF Files. Thanks for any help you can give.
Searching In Text Files
First i want to say Hello becuase its my first post on this forum. I dont know if my thread is in the right section lol.
I'll start with my problem:
I have a text file:
- MyText.txt
- a textbox {Text1}
- a command button {command1}
When we hit Command1 it must do the follow:
1} Load the text file in the memory
For example the Text file contains:
Mercedes 50 47 98
Bently 60 78 50
Ferrari 58 54 01
2}Now we want to change the whole Bently line with the line in the Textbox:
Bently 45 98 60
So what it needs to do: Get the first word of the Textbox and search with that word in a text file, find the line, replace that whole line with the line in the Textbox.
For opening Text files I use this code:
Code:
'(general declaration)
Dim nFileNum As Integer, sText As String, sNextLine As String, lLineCount As Long
'==================================
Private Sub Command1_Click()
' Get a free file number
nFileNum = FreeFile
' Open a text file for input. inputbox returns the path to read the file
Open "C:Documents and SettingsSudeepMy Documents3.txt" For Input As nFileNum
lLineCount = 1
' Read the contents of the file
Do While Not EOF(nFileNum)
Line Input #nFileNum, sNextLine
'do something with it
'add line numbers to it, in this case!
sNextLine = sNextLine & vbCrLf
sText = sText & sNextLine
Loop
Text1.Text = sText
' Close the file
Close nFileNum
End Sub
So in a general view:
Put text in the textbox
hit command 1
Find the first word of the textbox
open the text file
Find the line of that word
Replace the line with that from the Textbox
Thanks
Help! Searching For Text In .txt Files
Hiya i really need some help so any input would be really really helpful. I need to be able to search through multiple .txt files, stored in several directorys, for a certain line of text in each file. If the text is found in that file i need a msg box to come up saying something like "Match found in file ?????.txt" continue to next file. can this be done as i have only started learning VB6 quite recently If you can offer any help that would be great!!!!!!!!!!!!
Searching MS Word Files.
I'm trying to write a program that searches Microsoft Word files for a particular word, everytime I search my program returns the error "Input Past End of File." Anyone know what I'm doing wrong? Here's my code, I think it may have something to do with the part where I put "doc = Input(LOF(ff), ff)" but I'm not sure.
Code:
Private Sub cmdSearch_Click()
Dim find As String
Dim fldr As String
Dim search As String
search = txtWordToSearch.Text
fldr = directoryList.path & ""
find = Dir$(fldr & "*.doc")
Do While Len(find)
SearchFile fldr & find, search
find = Dir$()
Loop
End Sub
Public Sub SearchFile(ByVal fil As String, ByVal SearchFor As String)
Dim doc As String
Dim ff As Integer
ff = FreeFile()
On Error GoTo Probs
Open fil For Input As #ff
doc = Input(LOF(ff), ff)
Close #ff
If InStr(1, doc, SearchFor, vbTextCompare) > 0 Then
lstFound.AddItem (fil)
End If
On Error GoTo 0
Exit Sub
Probs:
MsgBox "The following error occurred: " & vbCrLf & Error$
On Error GoTo 0
End Sub
The computer I'm doing the programming on does not have internet access (I'm at work) so I'll be jumping back and forth from that computer to this one so if you have questions and I don't respond right away just be patient.
Searching Xls Files For Specific Vb
Is there a program or a way to search xls files for specific visual basic? Kind of like searching for a file in windows, where I could say that I am looking for the term, for example, "activeworkbook" through all excel files and it would tell me which xls files contain a script with "activeworkbook" in it? I wrote a function about 4 months ago and I can't find it and I have hundreds of xls files. i am looking for a quicker way than looking individually.
Thanks for the help as always,
Bob
Searching Files For A String
I would like to search for specific strings within several text files (similar to the Windows Find Files or Folders feature). Is there a way to do this by using some type of method in Visual Basic?
Searching Inside Files
Hi,
I need to make an app that searches inside PDF file for specific string.
example:
User types author name in text field.
The app searches the PDF files for that Author.
All the results the app will show in a list box.
Then the user will click the file he wants to open.
So. How do I make that search and paste the file name inside
List box?
10x,for your help!
Searching For Files In A Directory
I am seeking a command that will allow me to find files in a specified directory. I would also like the number of files in that directory. In other words I am looking for methods which will allow me to return all the files names in a specified directory and another to return the number of files in the directory.
Searching In Text Files
Hi,
I have a text file with following records:
UID KEYID DAY
--- ----- ---
user1 7637463 Monday
user2 8979838 Tuesday
user3 8937089 Wednesday
I want to perform File operations of Search, Modify etc. like:
Open "...." For Random As #1
.
.
Close #1
How to search for any record with all the 3 fields,
and display data.
................
Rohit.
Searching Files + PrintScreen
How can I make a Find File thing?
for example I want to search drive C:
for bla.txt
if found
put its link/directory to text1.text
**************
Can I make a code to PrintScreen (that key near SCROLL LOCK)?
Like when clicked command1, printscreen and put it in C:screen.jpg?
**************
Reading And Searching .txt Files
I've created a program that addes files to a combobox from the file "newtest.txt" and also writes text to the "newtest.txt" aswell the problem is that the last line in the "newtest.txt" is never written into the combobox.
newtest.txt file
VB Code:
"Maths Table","Maths""Science Table","Science""English Table","English""PE Table","PE"
Read Script
VB Code:
Open "E:NewTest.txt" For Input As #1Dim varItem As StringDim varlocation As String Input #1, varItem, varloactionDo While Not EOF(1) = TrueCombo1.AddItem (varItem)Input #1, varItem, varloactionLoopClose #1
Write Script
VB Code:
Private Sub CmdWrite_Click()Open "E:NewTest.txt" For Append As #2Dim varItem As StringDim varlocation As String varItem = txtitem.Textvarloaction = txtlocation.Text Write #2, varItem, varloactionClose #2End Sub
For example using all the codes above when I run my program "English Table" would be the last item in the combobox not "PE Table"
Also is there any way that I can search the "newtest.txt" file for some text in varitem and then input the text from varlocation into my program.
Need Code For Searching Files
can someone tell me a code that can search files in the whole hard drive and display the location of the file in the textbox control or listbox control
ex. if the first file found then file display the location in text1.text and if the second file found dispaly it to text2.text
thanks in advance!!!
sorry for my poor english
Searching For Movie Files
How would I make a program that searched the ENTIRE computer for movies by looking at file's extensions?
Searching Files Using FindFilesAPI
Hi!
I'm using the FindFilesAPI from allapi.net to search a folder chosen by the user for all files ending in .zip and .adf. This has been working fine for some time but have now come across a strange problem where sub-folders are not picked up and scanned.
If the user selects a folder on drive F:, it will scan the selected folder and all sub-folders for all files with the extensions .zip or .adf. However if they select a folder on drive E: the sub-folders are not scanned.
Both drives are NTFS and I can't figure out any reason why one drive works fine and the other doesn't.
Could anyone help me solve this problem please?
Searching Text Files
I have developed an app that i want to search specific text files and provide info from there.
I want to search a file called abc.txt. The top line of that is :
Starting file copy: XCOPY "\FPSPUD004INVENTRY101441FILES*.*" "c:" /E /H /I /V /R
I want to be able to display in a text box (txt123), FPSPUD004. Presumably i need to search for "Starting file copy: XCOPY "\" and display whatever is after it and before "INVENTRY101441FILES*.*" "c:" /E /H /I /V /R"
Any help ????
Searching Large Files
My program allows searching (using instr) thru all kinds of files for particular strings....but what ive noticed is that some files dont actually get reported as having the string in them (when i know they do!) and i think its because i am using stringname = LOF(filenumber).
VB strings i believe can only hold 64k (correct me if im wrong), which means that files over this max string size dont get searched. Whats the best way of loading a large file (both text and Binary) into a string type variable so it can be searched?
Thanks
Searching For Files Over A Network
hello gentlefolk,
Has anyone written any code for searching files over a Local network? Im using FindFirstFile/FindNextFile to search the hard drive but if the user clicks the network icon id like to perform a search over that too. Will these 2 apis do that or do i have to be cleverer than that? Has anyone any example code to share? Thanks for any help
Searching Drives For Files
Greetings,
What would the code be, for the comments for in my Form_Load:
Private Sub Form_Load()
'for each directory/folder/subfolder/file
'if the file suffix is ".tmp" then
'put the directory name into listbox1
'end if
End Sub
Thank you,
Jim
Searching Text Files
Please see code below.
I want to search through a text file and find a specific entry. The install.log is quite a big file and i want to look for certain enteries in there. For example, the first section works fine in that it finds the text "SUCCESSFUL on NTW" at the bottom of the log and therefore gives the msgbox Distribution Successful.
However, i have stored the remainder of the entry in a database. I want to search the text file to search for specfic enteries in the database and match up. This only works if the database entry exactly matches what is in the log file. This is no good as i want the code to searxh the log file for the small part in the database.
Open "c:hbsutilsinstall.log" For Binary Access Read As #1
sData = Space$(LOF(1))
Get #1, , sData
MsgBox sData
If InStr(1, sData, "SUCCESSFUL on NTW") <> 0 Then
MsgBox "Distribution Successful"
Else
Do Until rstPackage.EOF
If sData = rstPackage("Fault") Then
txtDiagnoseProblem.Text = rstPackage.Fields("Problem")
Exit Do
Else
rstPackage.MoveNext
End If
Loop
Do Until rstPackage.EOF
If sData = rstPackage("Fault") Then
txtDiagnoseFix.Text = rstPackage.Fields("Fix")
Exit Do
Else
rstPackage.MoveNext
End If
Loop
End If
Searching For And Renaming Files
Hello,
I need to write a simple VB program that will search for all files of type jpg in a particular directory. It needs to look in all the subdirectories too. Basically I want it to do exactly what the standard "Windows file search" dialog does only I want to be able to access each of these found files and rename them one at a time in a loop. Does anyone have any suggestions or sample code. I'm very new to VB and I'm using version 6.0.
Thanks!
Elisa
Searching In Files For Keywords
hi
i want to script a little programm that searches for special keywords in files.
I have 3000 Pictures and 3000 *.dsc files (normal textfiles containing informations about each picture, for example what person is on a special picture)
i want to script a search programm that finds all the pictures on which a special person is.
i want my programm
1) to scann a whole directory for *.dsv files
2) open each file and check if there is the line:
[person = name]
3) write the path of the pictures into a textfile
but i dont know how to do step 1-3....
can anybody help me?
thanx
Question With Searching And Files
I am trying to create a program to look for forms on my server. I decided that I want to make the program search all the documents on the server and fin the ones that use the words
"</form>"
"submit"
"form"
After it searches through the files, I will need to print out the list (this is why I have to create the program instead of using the search function built into windows...it can't print the list)
I already have a searching function that will search and find all the files on the server, and I can do the print function...but I don't know how to make it search for specific words
any clues?
Searching For Files Question
I have a form with 4 text boxes on it. From here users can enter in data that in turn I program to search the DB based on the data submitted.
My problem is that the search results don't always bring back the exact results they queried for.
Any ideas?
Code:
sql = "SELECT * FROM Master WHERE Master.Title = '" & txtTitle.Text & "' or Master.Cat = '" & cboCat.Text & "' or Master.FileExtension = '" & cboFE.Text & "' or Master.FileName = '" & txtIFN.Text & "'"
rs.Open sql, conn, adOpenStatic, adLockOptimistic
If rs.EOF Then
MsgBox "No files found for the search criteria.", vbOKOnly, "Search Results"
Else
For lngItem = 1 To lngCount
'Adds the item to the list
frmMain.lvwResults.ListItems.Add , , "" & rs!Title
'Adds the ListSubItem of the first item added
frmMain.lvwResults.ListItems(lngItem).ListSubItems.Add , , "" & rs!Cat
frmMain.lvwResults.ListItems(lngItem).ListSubItems.Add , , "" & rs!FileName
rs.MoveNext
Next
End If
Searching Text Files
Does anyone know how to write a search that will search x number of text files for a specific string that the user will enter and send back the results in a linked format.
What I'm after is sorta like when you do a web search and it sends back urls.
This may not even be possible. I will not know how many text files to loop through but they all will be in a certain directory.
|