Home > Articles > Programming > Windows Programming

Text File Operations in .NET

Do you miss legacy Visual Basic? John Traenkenschuh did, until he discovered some of the cooler features of Visual Basic .NET that are useful for working with text files.
Like this article? We recommend ๏”€

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.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.