File System Object

V

Vicky S

Hello,
I'm new to dot net and I can't seem to find the object name that is
equivalent to Scripting.FileSystemObject. Can anyone help?

Thanks,
V
 
V

Vicky S

and also.. for the functions right(string, len_returned) and left(string,
len_returned)
 
V

Vicky S

Thanks,
I can now generate a file.. but for some reason, it's not writing to it..
what am I doing wrong?

Dim oFile As System.IO.File, oStream As System.IO.StreamWriter

Dim filename As String

filename = Application.ExecutablePath & "\..\importlog.txt"

oStream = oFile.CreateText(filename)

oStream.WriteLine(Now() & " " & strMessage)
 
J

Juliano Bortolozzi

In your example you just have to call the Close method of the stream object.

But, to do what you want, I'd consider a different approach:

Dim stream As System.IO.StreamWriter

Try

stream = New System.IO.StreamWriter("c:\temp\test.txt", True)

stream.Write("test")

Finally

If Not stream Is Nothing Then

stream.Close()

End If

End Try


Note that you can't forget to close the stream, even if an exception has
occured.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top