Chapter 13 Exploring Text Files and String Processing 323
LineOfText = InputBox("Enter line")
Loop
StreamToWrite.Close()
Using the WriteAllText Method
The following exercise demonstrates how you can use TextBox and SaveFileDialog controls to
create a simple note-taking utility. The program uses the WriteAllText method to write string
data in a file. You can use this program to take notes at home or at work and then to stamp
them with the current date and time.
Run the Quick Note program
- Click the Close Project command on the File menu.
- Open the Quick Note project in the C:\Vb10sbs\Chap13\Quick Note folder.
The project opens in the IDE.
- If the project’s form isn’t visible, display it now.
The Quick Note form opens, as shown in the following screen shot. It looks similar
to the Text Browser form. However, I replaced the OpenFileDialog control with the
SaveFileDialog control on the form. The File menu contains the Save As, Insert Date,
and Exit commands.