Text File Operations in .NET
The Joys of Text Files
I like text files. They’re easy to understand, which makes them great teaching tools. After all, sooner or later each program must save its results.
Imagine my disappointment when Visual Basic .NET came out. The online help for text files never provided clear instructions on the setup and use of these files.
My conversations with others, including MVPs, reached the same conclusions: We were confused regarding something as basic as a text file. Visual Basic 2005 seemed to confirm our thoughts; the My object brought us back to Visual Basic 6 ease-of-use. But the My object is provided to VB coders only, and isn’t available to Compact Framework coders. What to do?
This article maps Visual Basic 6 terms and operations to .NET equivalents. Moreover, it uses core .NET classes, which you can use with Forms or with compact/CE programming. I’ll demonstrate a basic write and a read. Once you see how easy it is to do, you’ll never go back.