Appendix J. Form Objects

This appendix describes the most useful properties, methods, and events provided by the Windows Form class.

The Form class inherits indirectly from the Control class (Control is the Form class's "great-grandparent"), so in many ways, a form is just another type of control. Except where overridden, Form inherits the properties, methods, and events defined by the Control class. Chapter 9, "Using Windows FormsControls," discusses some of the more useful properties, methods, and events provided by the Control class and most of those apply to the Form class as well.Appendix A, "Useful Control Properties, Methods, and Events," summarizes the Control class's most useful properties.

PROPERTIES

The following table describes some of the most useful Form properties.

PROPERTY

DESCRIPTION

AcceptButton

Determines the button that clicks when the user presses the Enter key. This button basically gives the form a default action. Most forms used as dialog boxes should have an Accept button and a Cancel button (see the CancelButton property described shortly). This makes the form more accessible to the visually impaired and is more efficient for users who prefer to use the keyboard.

ActiveControl

Gets the form's currently active control.

ActiveForm

Gets the application's currently active form. If an MDI (Multiple Document Interface) child form is active, this returns the active form's MDI parent.

ActiveMdiChild

Gets the MDI parent form's currently active MDI child form.

AllowDrop

Determines ...

Get Visual Basic® 2010 Programmer's Reference 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.