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.
"Vicky S" <> wrote in message
news:#...
>
> 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)
>
>
>
> "Juliano Bortolozzi" <> wrote in message
> news:...
> > Take a look at System.IO
> >
> > "Vicky S" <> wrote in message
> > news:#...
> > >
> > > 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
> > >
> > >
> >
> >
>
>
|