Home » C# Basics » 09 - Windows Programming - 2
9

Working with files

This guide will show an example of how a simple windows application similar to notepad is developed.

Before we proceed, let us understand the application we are creating. The application will be used to work with text files. Just like the Notepad application that comes with the Windows operating system, our application will be used to create, save and open text files. Note that we are not going to implement all the features of the Notepad application. We will concentrate on opening, saving and printing text files.

For this, we will use a textbox control. Drag and drop a textbox control on the form, just below the toolbar we have just created. Set its MultiLine property to true (multiple lines of text can be entered in the textbox control) and Scrollbars property to vertical (a vertical scrollbar will be displayed in the textbox control). Set the AcceptsReturn and AcceptsTab properties to true (so that the `ENTER' and `TAB' keys can be used in the textbox). Set the Dock property to Fill (the textbox control will fill the entire available area in the form). Also, set the (Name) property to txtInput.

With this, we are now ready to work with text files. In the next section, we will learn about windows common dialogs that will help us with opening, saving and printing text files. We will also learn how to change the fonts and colors.