| Managing Windows Forms | |||||||||
| Going Beyond the Book: Providing Help | |||||||||
|
The first example in the chapter is a very simplified Help window. Although the purpose of this example is really just to demonstrate how to manage multiple forms in a project, you might be left with the impression that this is the recommended way to provide help screens for your system. NOTHING could be further from the truth! One of the bigger upgrades in VB.NET is the addition of new ways to provide help in a system. Most of them are based on extensions to VB.NET forms. Studying the ways help can be provided in VB.NET illustrateS both how an important VB.Net Namespace - Forms - is extended, and also shows you some valuable programming tips for help that you can use in your code. Help can be very sophisticated and complex or very simple. Here's an overview. |
|||||||||
As our first example, let's change the help system for the Lucky Seven example from the book and use the HelpButton property and the HelpRequested event for the Lucky Seven form. This property is already there in the form. All we are going to do is put it to use. HelpButton allows you to either press the F1 key or click the HelpButton to get help. To add this to the Lucky Seven project in the book, follow these steps. Now it's time to add the programming that will display the same ReadMe.txt file using the HelpButton object. This object will raise an event called HelpRequested for specific components, or using the HelpButton. To do this ... To use the HelpButton, click the button (it's the one with the question mark in it at the top right) then click inside any of the components. If you click on a blank spot in the form, nothing will happen. This is because the HelpButton is designed to allow you to display different things for different components but in this simplified example, we just selected all of the components - but not the form - using the Handles MyBase.HelpRequested clause in the Sub textBox_HelpRequested declaration. The cursor then changes into the HelpRequsted cursor and when you click again, the Sub textBox_HelpRequested code is executed to display the file.
The HelpRequested event code is also executed if you press F1. |
|||||||||

