Arrays

  • Thread starter Thread starter HardySpicer
  • Start date Start date
H

HardySpicer

Ok I am referring to this rather nice search Class I found here

http://www.vbforums.com/showthread.php?t=341919

It searches for various file extension types and works really well.
Trouble is I need the full path as well as the name of the file.
Somebody asks how to do this on the forum and the reply is
.....
It is an arraylist of fileinfo. so you will need to use for each
statement to retrieve each element of the array. then use the
element.fullname to get the full path
......


I am a bit confused by this being quite new to the language. Any help
would be appreciated. The search itself works fine but I need teh full
path.

Hardy
 
Ok I am referring to this rather nice search Class I found here

http://www.vbforums.com/showthread.php?t=341919

It searches for various file extension types and works really well.
Trouble is I need the full path as well as the name of the file.
Somebody asks how to do this on the forum and the reply is
....
It is an arraylist of fileinfo. so you will need to use for each
statement to retrieve each element of the array. then use the
element.fullname to get the full path
.....

I am a bit confused by this being quite new to the language. Any help
would be appreciated. The search itself works fine but I need teh full
path.

Hardy

Well, the files property of the class returns and arraylist of
FileInfo objects. FileInfo objects have a property FullName that
gives the full path to the file... So, what they are suggesting is
that you can get the information by doing something like:

foreach fi as fileinfo in fs.Files
if fi.name = "somefile.txt" then
return fi.fullname
end if
next

Make sense?
 
Well, the files property of the class returns and arraylist of
FileInfo objects. FileInfo objects have a property FullName that
gives the full path to the file... So, what they are suggesting is
that you can get the information by doing something like:

foreach fi as fileinfo in fs.Files
if fi.name = "somefile.txt" then
return fi.fullname
end if
next

Make sense?

Thanks for that but it says fileinfo is not defined and I cannot see
it as a property of the serach class.

Hardy
 
Thanks for that but it says fileinfo is not defined and I cannot see
it as a property of the serach class.

Hardy- Hide quoted text -

- Show quoted text -

FileInfo is a class in System.IO so, you need to make sure you have
Imports System.IO at the top of your file.
 
Well, the files property of the class returns and arraylist of
FileInfo objects. FileInfo objects have a property FullName that
gives the full path to the file... So, what they are suggesting is
that you can get the information by doing something like:

foreach fi as fileinfo in fs.Files
if fi.name = "somefile.txt" then
return fi.fullname
end if
next

Make sense?

Got it!! Thanks -for future ref it's


For Each f As System.IO.FileInfo In x.Files
If f.Name = curItem Then
fullpath = f.FullName
End If
Next

Label2.Text = fullpath

Where curItem is a selected file from the array done previously by the
mouse.

Hardy
 
Back
Top