jindalee
asked on
FileAttributes.hidden problem
I have to display the attributes of a file in a lits box. I am using the attached code to get the attribute.
The problem I am getting is that even though I have set a known file to Hidden, i get the error message shown in the attached image.
If I change fi.attributes to FileAttributes, it always sets fileHidden to "False"
Can someone please enlighten me to what I am doing wrong?
(I am doing stuff like ensuring the file exists etc before testing the attributes)
The problem I am getting is that even though I have set a known file to Hidden, i get the error message shown in the attached image.
If I change fi.attributes to FileAttributes, it always sets fileHidden to "False"
Can someone please enlighten me to what I am doing wrong?
(I am doing stuff like ensuring the file exists etc before testing the attributes)
Dim fi As New FileInfo(fileName)
If fi.Attributes.Hidden() = True Then
fileHidden = "True"
Else
fileHidden = "False"
End If
fi-error.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very simple really :)
@jpaulino
The problem with that is that if the file has several attributes set, (fi.Attributes = FileAttributes.Hidden) == false
The problem with that is that if the file has several attributes set, (fi.Attributes = FileAttributes.Hidden) == false
That's not the easy/correct way but you should check my solution.
Opps, sorry you are right!
Open in new window