PrintForm.Form Property

Gets or sets the form to be printed.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

[BrowsableAttribute(false)]
public Form Form { get; set; }

Property Value

Type: System.Windows.Forms.Form
Returns a Form object.

If the PrintForm component is hosted on a form, the parent form is the default value. If an instance of a PrintForm component is created at run time, the Form property must be set. If it is not, a System.Argument.NullException exception is raised.

NoteNote:

When you use the basic Print method or the overloaded Print method with the PrintOption parameter set to CompatibleModeClientAreaOnly or CompatibleModeFullWindow, the form specified by the Form property must be the top-level form. If it is not, an exception is raised. To avoid this, check the TopLevel property of the form before you call Print.

The following example demonstrates how to set the Form property. This example requires that you have a PrintForm component named PrintForm1 on a form.

PrintForm1.Form = My.Forms.Form2

Community Additions

Show: