File System in VB6How to use FSO in VB6
Page 1 of 1
7 Replies - 16600 Views - Last Post: 24 August 2006 - 08:18 AM
#1
File System in VB6
Posted 22 August 2006 - 06:17 PM
Replies To: File System in VB6
#2
Re: File System in VB6
Posted 22 August 2006 - 07:36 PM
#3
Re: File System in VB6
Posted 23 August 2006 - 05:46 AM
first u need to create a FSO, then read from it like this:
dim fobject, file
Set fobject = CreateObject("Scripting.FileSystemObject")
Set file = fobject.OpenTextFile("C:\File.txt", 1) '1 stands for reading, 2 stands for writing
Text1.Text = file.ReadAll
file.Close
hope this helps u out
This post has been edited by Louisda16th: 24 August 2006 - 12:32 AM
#4
Re: File System in VB6
Posted 24 August 2006 - 03:53 AM
#5
Re: File System in VB6
Posted 24 August 2006 - 07:03 AM
how can u set file attributes like hidden, readonly thru FSO??
#6
Re: File System in VB6
Posted 24 August 2006 - 07:28 AM
Louisda16th, on 24 Aug, 2006 - 07:03 AM, said:
how can u set file attributes like hidden, readonly thru FSO??
Example:
Dim FSO as New FileSystemObject
Dim flFile as File
SET flFile = FSO.GetFile("c:\Test.zip")
flFile.Attributes = Hidden
This post has been edited by Nevermalchik: 24 August 2006 - 09:23 AM
#7
Re: File System in VB6
Posted 24 August 2006 - 07:50 AM
Nevermalchik, on 24 Aug, 2006 - 07:58 PM, said:
Louisda16th, on 24 Aug, 2006 - 07:03 AM, said:
how can u set file attributes like hidden, readonly thru FSO??
Example:
Dim FSO as New FileSystemObject
Dim flFile as Files
SET flFile = FSO.GetFile("c:\Windows\")
you can do a loop, or search for particulare file...
flfile.item(0).attributes = <a enum will appear>
Is it possible to do this while creating the file itself. for example:
Dim User As Object, FSO As New FileSystemObject
Set User = FSO.CreateTextFile("C:\Hello.txt", True)
User.Write "Hello"
User.Close
what can u do here.
What i tried is declaring user as File. but the compiler says dat the Write Method or data member not found. If i declare User as object then the attribute property doesnt exist.
#8
Re: File System in VB6
Posted 24 August 2006 - 08:18 AM
Nevermalchik, on 24 Aug, 2006 - 07:58 PM, said:
Louisda16th, on 24 Aug, 2006 - 07:03 AM, said:
how can u set file attributes like hidden, readonly thru FSO??
Example:
Dim FSO as New FileSystemObject
Dim flFile as File
SET flFile = Set bnkFile = FSO.GetFile("c:\Test.zip")
flFile.Attributes = Hidden
works. Thanx
|
|

New Topic/Question
Reply




MultiQuote



|