Reading from and writing to csv and txt files

J Trahair

Well-known member
Joined
May 14, 2008
Messages
175
Location
Spain
Programming Experience
10+
I am converting a small app from normal VB2005 to vb for Windows CE5.0 for a handheld computer. I need it to read from csv and txt files, and also to write such files.

Such as
VB.NET:
            mnumFileNumber = FreeFile()
            'Read file = OpenMode.Input.
            FileOpen(mnumFileNumber, mstrPathToFilesEndsInSlash & "Operators.txt", OpenMode.Input)

            Do While Not EOF(mnumFileNumber)
                strReceiveLine = LineInput(mnumFileNumber)
                If InStr(1, strReceiveLine, "," & Text1.Text & ",") > 0 Then
                    Do Until strReceiveLine = "" Or strReceiveLine = "x"
                         'Whatever...
                    Loop
                    Exit Do
                End If
            Loop

            FileClose(mnumFileNumber)
What are the replacements for FreeFile, OpenMode, FileOpen, EOF, LineInput, FileClose, and Write and WriteLine?

Also, it seems Application - as in Application.Exit() - needs a System.Something.

Any pointers? Thanks in advance.
 
System.IO Namespace

The System.IO namespace

VB.NET:
Private _TextWriter As StreamWriter
_TextWriter = New System.IO.StreamWriter(fileName, True)
_TextWriter.WriteLine(data.ToString)
_TextWriter.Flush()
 
Last edited:
Back
Top