Directory attributes

homebrew311

Active member
Joined
Oct 25, 2003
Messages
31
Im making a prog that can hide and show directories. im stuck. i can hide them, but i dont kno how do make it back to normal. heres wut i have so far

If Directory.Attributes = FileAttributes.Hidden Then
Button.Text = "Un-hide directory"
ElseIf Directory.Attributes = FileAttributes.Directory Then
Button.Text = "Hide directory"
End If

i kno that this just sees if it is hidden or not, and if i figure it out i can just apply it to the rest of my code. What am i doing wrong?
 
This doesnt work for you?

Dim strFullPath As String = "c:\temp\testDir"
hide dir
System.IO.File.SetAttributes(strFullPath, FileAttributes.Hidden)

unhide dir
System.IO.File.SetAttributes(strFullPath, FileAttributes.Normal)

It works well here.

Shamil
 
well, i thot it would, but it doesnt. i just did msgbox(directory.attributes) and it returned 18 for some reason. so i put 18 in place of directory.attributes = fileattributes.hidden and it worked fine.
 
Back
Top