When Can I Use FSO FileSystemObject

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2004
Posts: 638
Reputation: Thong_Ispector is an unknown quantity at this point 
Solved Threads: 18
Thong_Ispector's Avatar
Thong_Ispector Thong_Ispector is offline Offline
Practically a Master Poster

When Can I Use FSO FileSystemObject

 
0
  #1
Oct 9th, 2005
When can you use FSO in a VB 5 program?
I got it working... I know it is supposed to be for ASP...
But why does it work in some applications ans situations and not others.?


Here is the code

Private fso As New FileSystemObject
Private strName As String

Private Sub Command1_Click()
With fso
strName = .BuildPath(Text2.Text, Text3.Text)
Set strm = .CreateTextFile(strName, True)
strm.Write (Text1.Text)
End With
MsgBox "text saved"
Exit Sub
a:
MsgBox "an error has occurd"
End Sub

Private Sub Command2_Click()
' Text1 is used to display the text file
' Text 2 is the Drive
' Text 3 is the Filename...

On Error GoTo a
With fso
strName = Text2.Text & "\" & Text3.Text
Set strm = .OpenTextFile(strName, ForReading)
With strm
Do Until .AtEndOfStream
Text1.Text = Text1.Text & .ReadLine & vbCrLf
Loop
End With
End With
Exit Sub
a:
MsgBox "an error has occurd"
End Sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC