Partager via


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)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property Form As Form
[BrowsableAttribute(false)]
public Form Form { get; set; }
[BrowsableAttribute(false)]
public:
property Form^ Form {
    Form^ get ();
    void set (Form^ value);
}
[<BrowsableAttribute(false)>]
member Form : Form with get, set
function get Form () : Form 
function set Form (value : Form)

Property Value

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

Remarks

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.

Note

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.

Examples

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

.NET Framework Security

See Also

Reference

PrintForm Class

Microsoft.VisualBasic.PowerPacks.Printing Namespace

Other Resources

PrintForm Component (Visual Basic)

How to: Print a Form by Using the PrintForm Component (Visual Basic)

How to: Print the Client Area of a Form (Visual Basic)

How to: Print Client and Non-Client Areas of a Form (Visual Basic)

How to: Print a Scrollable Form (Visual Basic)

Deploying Applications That Reference the PrintForm Component (Visual Basic)