Example

Printing Records.


Printing records sub procedure.

The following is a simple example of how to print the records in the grid after showing a Print dialog box.  The sub procedure assumes you have Common Dialog control named "CD1" and a DGrid control named "DGrid1" sited on the form.


Private Sub ShowPrintGrid()
    On Error Resume Next
    Err.Clear
    'Set flags and show the Print common dialog box
    CD1.Flags = &H1 Or &H100000
    CD1.Action = 5
    If Err Then Exit Sub 'user canceled 
    DoEvents
    Screen.MousePointer = 11
    Printer.Orientation = CD1.Orientation
    If CD1.Flags And &H1 = 1 Then 'Print Selection 
        DGrid1.PrintGrid Printer
    Else 'print the entire grid
        DGrid1.PrintGrid Printer, True
    End If
    Screen.MousePointer = 0
End Sub