I have found a piece of code that will allow me to print with a listview. However, when I code the PrintPageHeader portion, it says PrintPageHeader is not declared. I did not know that i had to declare it and if I do declare it what do I declare it as? Anyway here is my code so far:
Any Ideas?
Thanks, Chester
Code:
Private Sub PD_PrintPage(ByVal sender As Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles PD.PrintPage
PageNo += 1
PageWidth = PWidth - _
(PD.DefaultPageSettings.Margins.Left + _
PD.DefaultPageSettings.Margins.Right)
PageHeight = PHeight - _
(PD.DefaultPageSettings.Margins.Top + _
PD.DefaultPageSettings.Margins.Bottom)
X = PD.DefaultPageSettings.Margins.Left
Y = PD.DefaultPageSettings.Margins.Top
Static startItem As Integer
Dim ColWidths(Me.ListView1.Columns.Count - 1) As Integer
' -Calculate the width of each column and the total width of the grid
Dim i As Integer, totWidth As Integer
For i = 0 To Me.ListView1.Columns.Count - 1
ColWidths(i) = Me.ListView1.Columns(i).Width
totWidth = totWidth + ColWidths(i)
Next i
PrintPageHeader(e.Graphics) 'Problem is here
End Sub
Any Ideas?
Thanks, Chester