Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2006, 07:59 AM
Authorized User
 
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default how set Attribute of Folder at Run Time

hi every one
plz tell me how set the attibute of folder at run time (such like Archive,hidden,readonly) when i create a folder on run time and copy any file in it then it give error permission denied (NTFS System).

Plz help me

 
Old April 3rd, 2006, 11:50 AM
Authorized User
 
Join Date: Mar 2006
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Raghunathan
Default

hi,

you can change the attributes of a folder at runtime using the FileSystemObjects.

here is the sample code to change the attributes of the folder (F:\MyFolder for example, setting a Hidden and ReadOnly attribute)

---------------------------------------------------------
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim strFolderPath As String

Dim attr As Scripting.FileAttribute 'Datatype for specifying the Attributesattr = Hidden Or ReadOnly 'Specifying the Attributes for the Folder
'you can use the OR operator to specify multiple attributes

strFolderPath = "F:\MyFolder" ' Path of the Folder, to change attributes
Set objFSO = New Scripting.FileSystemObject
Set objFolder = objFSO.GetFolder(strFolderPath)

objFolder.Attributes = attr 'Setting the Attributes for the Folder
-------------------------------------------

Regards,
Raghu
 
Old October 17th, 2007, 11:55 PM
Authorized User
 
Join Date: Dec 2005
Posts: 28
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to surendraparashar
Default

babu ji

Surendra





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error - Attribute cannot be set now ajish_jose Access 6 February 1st, 2005 04:38 AM
Set AdoDc properties at run time Psionman Pro VB Databases 2 November 10th, 2004 10:07 AM
Copying folder at run time Baby_programmer ASP.NET 1.0 and 1.1 Basics 3 October 7th, 2004 09:51 PM
DataGrid DataColumn Property Set at Run-time karhodes ADO.NET 0 April 14th, 2004 03:37 PM
How to set the multiline property at run time? harini19 VB How-To 3 January 9th, 2004 03:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.