Share via


Printer.Print Method

Prints text to a page.

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

Syntax

'Declaration
Public Sub Print ( _
    ParamArray args As Object() _
)
public void Print(
    params Object[] args
)
public:
void Print(
    ... array<Object^>^ args
)
member Print : 
        args:Object[] -> unit
public function Print(
    ... args : Object[]
)

Parameters

  • args
    Type: array<Object[]

    A parameter array containing optional printing parameters.

Remarks

The Print method resets CurrentX and CurrentY to the next line after executing (the same as inserting a carriage return). To continue printing on the same line, call the Write method instead.

Multiple expressions can be separated by either a space or a semicolon.

Note

Because the Print method typically prints with proportionally-spaced characters, there is no correlation between the number of characters printed and the number of fixed-width columns that those characters occupy. For example, a wide letter, such as a "W," occupies more than one fixed-width column, and a narrow letter, such as an "i," occupies less than one column. To allow for cases in which wider than average characters are used, your tabular columns must be positioned far enough apart. Alternatively, you can print in a fixed-pitch font (such as Courier) to make sure that each character occupies only one column.

The args() parameter array has the following syntax and parts:

{Spc(n) | Tab(n)} expressioncharPos

Parameter

Description

Spc(n)

Optional. Used to insert space characters in the output, where n is the number of space characters to insert.

Tab(n)

Optional. Used to position the insertion point at an absolute column number, where n is the column number. Use Tab without an argument to position the insertion point at the start of the next print zone.

expression

Optional. Numeric expression or string expression to print.

charPos

Optional. Specifies the insertion point for the next character. Use a semicolon (;) to position the insertion point immediately after the last character displayed. Use Tab(n) to position the insertion point at an absolute column number, where n is the column number. Use Tab without an argument to position the insertion point at the start of the next print zone. If charPos is omitted, the next character is printed on the next line.

Note

Functions and objects in the Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic. In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation.

Examples

The following example demonstrates the Print method.

Dim Printer As New Printer
Printer.Print("Total (" & (19 + 300) / 4 & ")")
Printer.EndDoc()

.NET Framework Security

See Also

Reference

Printer Class

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace

Other Resources

Printer Compatibility Library

How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)

Deploying Applications That Reference the Printer Compatibility Library