943,929 Members | Top Members by Rank

Ad:
Oct 9th, 2005
0

When Can I Use FSO FileSystemObject

Expand Post »
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
Similar Threads
Reputation Points: 16
Solved Threads: 19
Practically a Master Poster
Thong_Ispector is offline Offline
638 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Connect server with VB 6.0
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Stopping a timer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC