![]() ![]() ![]() TheSetError method takes two arguments: a reference to the control for which you are setting the error, and the error message to set.įigure 10.3. You set an error message for a control by calling the SetError method on the error provider control instance in your form. If you set an error message for a control that isn't null or an empty string, the error provider extender control will draw an error icon next to that control and will also display a tooltip when you hover the mouse over the error icon, as shown in Figure 10.3. The error provider control maintains a mapping of error messages associated with each control on the form. When you use an error provider control, you only need to add one to your form, and it shows up in the nonvisual components tray at the bottom of the designer (see Figure 10.2).įigure 10.2. ![]() The error provider (the ErrorProvider class) control is a special kind of control, called anextender provider control, that lets you add properties to other controls on the form from a single instance of the extender provider. Windows Forms 1.0 included the ErrorProvider control that provides a standard and less obtrusive way to notify a user of an error. Although this works, it is extremely disruptive to most users to use pop-up dialogs for something like this. In the example of handling the Validating event at the beginning of this chapter, I used the crude approach of popping up a message box when a validation error occurred. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |