Click here to Skip to main content
15,916,042 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionsearch hard drive for files Pin
jds12078-May-07 7:36
jds12078-May-07 7:36 
AnswerRe: search hard drive for files Pin
MatrixCoder8-May-07 7:59
MatrixCoder8-May-07 7:59 
AnswerRe: search hard drive for files Pin
Dave Kreskowiak8-May-07 8:10
mveDave Kreskowiak8-May-07 8:10 
GeneralRe: search hard drive for files Pin
jds12078-May-07 10:21
jds12078-May-07 10:21 
GeneralRe: search hard drive for files Pin
Dave Kreskowiak8-May-07 10:32
mveDave Kreskowiak8-May-07 10:32 
GeneralRe: search hard drive for files Pin
Dave Kreskowiak8-May-07 17:24
mveDave Kreskowiak8-May-07 17:24 
GeneralRe: search hard drive for files Pin
P P Vilsad8-May-07 21:21
P P Vilsad8-May-07 21:21 
AnswerRe: search hard drive for files Pin
P P Vilsad8-May-07 21:18
P P Vilsad8-May-07 21:18 
i didn't see any output from your search, just calling di.listfiles(type) but not adding it to anywhere!
and you are searching only C drive, what if your computer have morethan one drive.
try this
initialise your search like this

dim drv as driveinfo<br />
for each drv in my.computer.filesystem.drives()<br />
if drv.isready then<br />
searchfiles(drv.rootdirectory,type)<br />
end if<br />
next


and create a searchfiles method with path and filetype as parameters


private sub searchfiles(byval path as directoryinfo,byval filetype as string)<br />
try<br />
'this will handle the error access denied<br />
'list files<br />
dim fi as fileinfo<br />
for each fi in di.getfiles(filetype)<br />
Application.DoEvents()<br />
'do something with the file here<br />
next<br />
'now go through the directories and get files from subdirectories<br />
dim sdi as directoryinfo<br />
for each sdi in di.getDirectories()<br />
Application.DoEvents()<br />
searchfiles(sdi,filetype)<br />
next <br />
catch exception as ex<br />
end catch<br />
end sub

this will get you through all the directories in a computer.
hope this works for you

Vilsad P P
MCTS (Windows Applications) .Net 2.0

QuestionStart up Pin
scorp_scorp8-May-07 7:23
scorp_scorp8-May-07 7:23 
AnswerRe: Start up Pin
MatrixCoder8-May-07 7:55
MatrixCoder8-May-07 7:55 
AnswerRe: Start up Pin
nlarson118-May-07 7:58
nlarson118-May-07 7:58 
QuestionDataGridView - Display Row Numbers on Control Pin
RichardBerry8-May-07 4:26
RichardBerry8-May-07 4:26 
AnswerRe: DataGridView - Display Row Numbers on Control Pin
Rupesh Kumar Swami8-May-07 5:27
Rupesh Kumar Swami8-May-07 5:27 
GeneralRe: DataGridView - Display Row Numbers on Control Pin
RichardBerry8-May-07 7:43
RichardBerry8-May-07 7:43 
QuestionOffice 2007 ActiveX Pin
Stijn Courtheyn8-May-07 4:26
Stijn Courtheyn8-May-07 4:26 
QuestionNeed help with Word template Pin
Jats_4ru8-May-07 2:33
Jats_4ru8-May-07 2:33 
QuestionExtracting data from Web pages Pin
Farazj8-May-07 1:29
Farazj8-May-07 1:29 
Questionhow to access dynamically created control Pin
WorkingAcc8-May-07 1:07
WorkingAcc8-May-07 1:07 
GeneralRe: how to access dynamically created control [modified] Pin
Colin Angus Mackay8-May-07 2:26
Colin Angus Mackay8-May-07 2:26 
QuestionApplication Shortcut Pin
harsh_c7-May-07 21:56
professionalharsh_c7-May-07 21:56 
QuestionRe: Application Shortcut Pin
Jelle Stokroos7-May-07 22:33
Jelle Stokroos7-May-07 22:33 
AnswerRe: Application Shortcut Pin
harsh_c8-May-07 0:02
professionalharsh_c8-May-07 0:02 
AnswerRe: Application Shortcut Pin
theScorp7-May-07 22:44
theScorp7-May-07 22:44 
AnswerRe: Application Shortcut Pin
Craster8-May-07 4:52
Craster8-May-07 4:52 
QuestionNested Datagridview question. Pin
cheeken2u7-May-07 21:12
cheeken2u7-May-07 21:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.