StrataFrame Forum
Back
Login
Login
Home
»
.NET Forums
»
General .NET Discussion
»
How to determine if a folder is read-only...
How to determine if a folder is read-only...
Post Reply
Like
0
How to determine if a folder is read-only...
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
StarkMike
StarkMike
posted 16 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 436,
Visits: 944
I cant seem to figure out how to determine if a folder is read-only through VB .NET. Any help? Thanks
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 16 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi,
Try the following code:
Dim
myDirectory
As
New
System.IO.DirectoryInfo(
"C:\TEMP"
)
If
myDirectory.Attributes =
System.
IO.FileAttributes.ReadOnly
Then
' Add your code here.
End
If
Edhy Rijo
Reply
Like
0
StarkMike
StarkMike
posted 16 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 436,
Visits: 944
Thanks!
Reply
Like
0
Greg McGuffey
Greg McGuffey
posted 16 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 2K,
Visits: 6.6K
The attributes property is a bitwise flag, so you actually want to use something like this:
Dim myDirectory As New System.IO.DirectoryInfo("C:\TEMP")
If (myDirectory.Attributes And System.IO.FileAttributes.ReadOnly) = System.IO.FileAttributes.ReadOnly Then
' Add your code here.
End If
Reply
Like
0
Trent Taylor
Trent Taylor
posted 16 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
Yup...Greg nailed it!
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search