Is something like this you are looking for ?
-A simple function that you pass in some text. It makes sure the file is
there, if not it creates it and then "APPENDS" the
text to the end of the file.
=================
Public Function WriteTextFile(ByVal ExtraString As String)
Dim FileName As String = "Text.txt"
Dim oTextFile As System.IO.File
Dim oTextWriteText As System.IO.StreamWriter
'Check if file exists...if not create it.
If Not System.IO.File.Exists(FileName) Then
oTextWriteText = oTextFile.CreateText(FileName)
oTextWriteText.Close()
End If
'If something passed in
If Not ExtraString = String.Empty Then
'Blank Line between last line.
oTextWriteText.WriteLine()
oTextWriteText.WriteLine( ExtraString )
oTextWriteText.WriteLine()
End If
'Closes the Text File.
oTextWriteText.Close()
End Function
=================
Miro
[quoted text, click to view] "John" <John@nospam.infovis.co.uk> wrote in message
news:O27b9Y4yGHA.4232@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I have done this much already;
>
> Dim JobsFS As FileStream
> If File.Exists(JobsFSPath) Then
> JobsFS = File.Open(JobsFSPath, FileMode.Append)
> Else
> JobsFS = File.Create(JobsFSPath)
> End If
>
> What I don't understand is how to write some text into it, like
> JobsFS.Write("This is some text") or something similar.
>
> Thanks
>
> Regards
>
>
> "Mike Lowery" <selfspam@mouse-potato.com> wrote in message
> news:%23vxHhL4yGHA.4408@TK2MSFTNGP05.phx.gbl...
>>
>> "John" <John@nospam.infovis.co.uk> wrote in message
>> news:%23nmQiF4yGHA.3584@TK2MSFTNGP02.phx.gbl...
>>> Hi
>>>
>>> I am trying to set-up an app log file that needs to be created if does
>>> not exists but opened for append if exists. How does one go about doing
>>> this? .net seems to have many ways to do io stream, boggles the mind.
>>
>> If File.Exists("c:\myfile.txt") Then
>> 'append
>> Else
>> 'create
>> End If
>>
>>
>
>