Search function [help in VB-2010]
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts
Page 1 of 1
Helloooo, 
I just got stuck in my app, cuz i dont know how to make a search function, like if i wrote "test" in textbox1 and press a button , it will put ALL the "test" . (ALL file types)
![Image]()
http://imgur.com/xkQiG
like the image <<
thanks

I just got stuck in my app, cuz i dont know how to make a search function, like if i wrote "test" in textbox1 and press a button , it will put ALL the "test" . (ALL file types)

http://imgur.com/xkQiG
like the image <<
thanks
How would you like to display results?
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo![]()
in the listbox, look in the picture, if i wrote "test" in the TEXTBOX1 then press BUTTON1 all search found will be in Listbox1 with full location, see the pic and u will know, thx 

Maybe this code helps:
Code: Select all
You can change "Desktop" to for example to "My Documents" or "My Pictures" for searching in other directories.For Each File In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.Desktop, FileIO.SearchOption.SearchAllSubDirectories, Nothing)
Dim foundFile As String = My.Computer.FileSystem.GetFileInfo(File).Name
If foundFile.Contains(TextBox1.Text) Then
ListBox1.Items.Add(foundFile)
End If
Next
#DeveloperJacob , i used the code, but when i press the button it freeze, and i waited and nothing happened, any ideas? and btw i wrote in the textbox many things like "Filename" and "Filename.exe" non worked,
thx
thx
CodenBoy wrote:#DeveloperJacob , i used the code, but when i press the button it freeze, and i waited and nothing happened, any ideas? and btw i wrote in the textbox many things like "Filename" and "Filename.exe" non worked,With the code that I posted you can only search on your desktop. So if you don't have the file on your desktop it will freeze.
thx
If you don't want your program freeze than you can use Try and Catch. And you can search a special directory by replacing
Code: Select all
with for example: My.Computer.FileSystem.SpecialDirectories.Desktop
Code: Select all
."C:\Program Files"
Worked !!
Thaaaaaaaaaaanks #DeveloperJacob
thx bro, lol but it said filename.txt can u give me a code so the result in listbox be like "C:/mydocuments/files/subfiles/filename.txt" i dont want only filename.txt
any help?
thanks
Thaaaaaaaaaaanks #DeveloperJacob

thx bro, lol but it said filename.txt can u give me a code so the result in listbox be like "C:/mydocuments/files/subfiles/filename.txt" i dont want only filename.txt
any help?
thanks
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023