TAB(x) does not work in Streamwriter
Posted on 2005-05-04
Streamwriter doesn't seem to support TAB(x), where x is the numeric print column value.
Dim fs As New System.IO.FileStream("C:\Export.txt", FileMode.Create)
Dim sw As New StreamWriter(fs)
sw.WriteLine("Print Column 1", TAB(50), "Print Column 50")
When I openthe file Export.txt and look at it notepad, only the text 'Print Column 1', the remaing text 'Print Column 50' does not show up in the file. What gives? Any way to make this work using streamwriter?
According to the VB.NET help the following works, but I'm figuring that the streamwriter class is the preferred way of writing to files and I want to use it instead of what's below, also I don't have to be concerned with the FreeFile thing.
FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output.
' The second word prints at column 20.
Print(1, "Hello", TAB(20), "World.")