| Managing Windows Forms | ||
| The HelpProvider Component | ||
|
The most powerful way to display Help, however, is to use the Windows Forms HelpProvider component and the HTML Help SDK. In large projects, there are whole departments of specialists who do nothing except work with the HTML Help SDK or one of the third party software systems that do the same thing such as RoboHelp. You can use the Windows Forms HelpProvider component to associate an HTML Help 1.x Help file (the file type is usually a .chm file but it could also be a normal HTML .htm file) with your Windows application. HelpProvider lets you create context-sensitive Help for controls, open a Help file to specific areas, such as the main page of a table of contents, an index, or a search function, and you can also show pop-up Help and ToolTips Help. Demonstrating how to create Help using the HTML Help SDK goes w-a-a-a-a-y beyond the scope of this class, but you can learn more about it at the Microsoft MSDN page, HTML Help Workshop. Or, download the HTML Help SDK. One way to describe chapter 15 of the book is that it tells you how to change the way a form responds in your program code. Here's another way. The new Windows Forms gives you a new ErrorProvider component. This is mainly used to pop up an icon to tell the user that something is wrong when your program is validating user input. In VB 6, programmers often used a message box for this. ErrorProvider is way more cool! To use ErrorProvider, drag it from the ToolBox onto your form. It then becomes another invisible component (like Timer) that you can use where needed. When the SetError method is called, ErrorProvider displays an icon (the default is the red exclamation point in a circle like the one above) and will also display ToolTip text for the error. Here's an example of code that uses ErrorProvider: When this example is run, you get this result: In the next lesson, we get even deeper into forms by describing the actual graphical methods that can be used in VB.NET to change the way they display in an appication. Before then, however, let me leave you with a new book recommendation. Matthew MacDonald's great book User Interfaces in VB .NET is heavy duty and detailed look at forms in VB.NET. If you want to get even more technical, this is a great way to do it. |
||

ErrorProvider has a lot of flexibility. For example, when the DataSource property is set, the ErrorProvider component can display error messages for a dataset. In the code below, I changed the Icon property to display something other than the default.
