Visual Basic Concepts
Running Code Examples from Help
See Also
Many of the language topics in Help contain code examples that you can run from Visual Basic. The following procedures show you how to copy and run a code example from Help.
Note The following procedure is for code examples that do not contain public declarations.
To copy a code example from Help
- Create a new form by choosing Add Form from the Project menu, or use an existing form. (For more information on creating and using forms, see "Developing An Application in Visual Basic.")
- Choose Index from the Help menu.
- In Help, search for graphics, and go to the topic called "FillColor Property."
- In the FillColor Property topic, click the Example jump, located in the nonscrolling region near the top of the window. (A jump is a word that you can click to go to another topic. Jumps are underlined and the jump text is colored.)
Select the Sub portion of the example. Note that the first "Sub" marks the beginning of the procedure and the last "End Sub" marks the end of the procedure.
- Right-click the selected text and select Copy from the context menu. The text is copied onto the Clipboard.
- Return to the form you created and double-click the form to display the Code window.
- Place the insertion point below any existing code in the Code window.
- From the Edit menu, choose Paste. The example now appears in the Code window.
- From the Run menu, choose Start, or press F5.
- Click the form to run the example code.
Note Some code examples require you to draw controls on the form. For more information on drawing controls, see "Forms, Controls, and Menus."