Live with Dot Net Just another Programming weblog

How to Write bunch of text to a file

Posted on April 22, 2009

Here is one of the way to Write bunch of text to flat file:

1
2
3
4
5
6
7
8
9
10
11
12
Public Sub WriteFile(ByVal sText As String, ByVal sFile As String, Optional ByVal bAppendMode As Boolean = True)
    Try
        Dim Stream_Writer As New IO.StreamWriter(sFile, bAppendMode)
        Stream_Writer.Write(sText & vbCrLf)
        Stream_Writer.Flush()
        Stream_Writer.Close()
    Catch ex As Exception
        'Statements to handle Errors
    Finally
 
    End Try
End Sub

About admin

No description. Please complete your profile.
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.