Link to home
Start Free TrialLog in
Avatar of Christopher Schene
Christopher ScheneFlag for United States of America

asked on

How to write out a text stream in VB.NET

Hi,

I want to write out a text stream in VB.NET and I tried this approach. The system doesn't like it because I am trying to write a character to a byte stream

Sub writeMyFile(ByVal path As String, ByVal content As String)
        Dim i As Long
        Dim myWriter As New System.IO.FileStream(path, IO.FileMode.Create)
        For i = 0 To content.Length - 1
                  myWriter.WriteByte(content.Chars(i))
        Next
        myWriter.Close()
    End Sub
end sub
ASKER CERTIFIED SOLUTION
Avatar of nayernaguib
nayernaguib
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Christopher Schene

ASKER

Works great! Thanks.