Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

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


  1. Click the Close Project command on the File menu.

  2. Open the Quick Note project in the C:\Vb10sbs\Chap13\Quick Note folder.


The project opens in the IDE.


  1. 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.
Free download pdf