|
-
November 14th, 2000, 10:22 AM
#1
Printing a DataGrid
Ok Last question,
What is the best method for printing the content of a datagrid control???
Thanks Chad
-
November 14th, 2000, 12:14 PM
#2
Re: Printing a DataGrid
Private Sub Command1_Click()
Call GridPrint(DataGrid1)
End Sub
Public Sub GridPrint(gridQuery As DataGrid)
Dim I As Integer
Dim J As Integer
Dim PTab As Integer
For I = 0 To gridQuery.ApproxCount - 1
PTab = 20 'Set the first tab value
'This checks to see if a page break is needed
If Printer.CurrentY + Printer.TextHeight(gridQuery.Text) > Printer.ScaleHeight - 600 Then
Printer.NewPage
End If
On Error Resume Next
gridQuery.Row = I 'Set the active row
On Error GoTo 0
For J = 0 To gridQuery.Columns.Count - 1
gridQuery.Col = J 'Set the current column
'Send the field to the print line and add the tab.
'Notice the semicolon at the end of the line.
Printer.Print Trim$(gridQuery.Text); Tab(PTab);
PTab = PTab + 20 'Increment the tab value
Next
'After each column has printed to the print line
'a Printer.Print statement without a semicolon will
'will send the line to the printer and start a new
'one.
Printer.Print
Next
Printer.EndDoc
End Sub
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|