Opening an Existing Document

In addition to being able to open a new blank child window, the user should have the capability of opening an existing text file and placing the contents of the file into a new child document. We will accomplish this functionality via the OpenFileDialog control, dlgOpen, that we placed on the form earlier.

Invoking the Open File Dialog Box

The user will expect to be able to open an existing text file by selecting Open from the parent form’s File menu. You will accomplish this by adding a single line of code to the Click event handler for the mnuFileOpen menu item:

1.
Make sure you are still in the Code window for frmParent.
2.
Select mnuFileOpen from the Class Name drop-down; then select Click from the Method ...

Get Special Edition Using Microsoft® Visual Basic® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.