Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Print the content of a MSHFlexGrid
Author:
Daniel M. Ionescu
E-mail:
Click to e-mail author
Submitted:
1/19/2004
Version:
VB6
Compatibility:
VB6
Category:
Controls
Views:
18823
This function allows to print the content of a MSHFlexGrid control and also if the property "AllowUserResizing" of the grid control is set to "flexResizingColumn" or "flexResizingBoth", the user is allowed to set the width of the columns to be printed.
Declarations:
Dim BeginPage, EndPage, NumCopies, Orientation, i Dim curi, curix As Long
Code:
Public Function PrintContent(Valid As Boolean) On Error Resume Next CommonDialog1.CancelError = True On Error GoTo ErrHandler CommonDialog1.ShowPrinter BeginPage = CommonDialog1.FromPage EndPage = CommonDialog1.ToPage NumCopies = CommonDialog1.Copies Orientation = CommonDialog1.Orientation 'How many copies to be printed For i = 1 To NumCopies Printer.FontSize = 8 Printer.ScaleMode = 1 curi = 200 curix = 0 contor = CLng((MSHFlexGrid1.Cols(0)) - 1) j = Printer.CurrentY For x = 1 To m If x <> 0 And x Mod 60 = 0 Then curi = 200 Printer.NewPage Else curi = curi + 240 End If For j = 0 To contor curix = MSHFlexGrid1.ColPos(j) Printer.CurrentY = curi Printer.CurrentX = curix Printer.FontBold = False Printer.Print MSHFlexGrid1.TextMatrix(x, j) Next curix = 0 Next Printer.FontItalic = True Printer.Print "Total " & m & " records" Printer.EndDoc Next Exit Function ErrHandler: ' User pressed Cancel button. Exit Function End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement