I am new to vb.net windows form
I have code (bit map method) using which i can print data grid but only one page not if grid has multiple pages(many rows)
i want to print all the rows around 90 +
Please help me with code to print dgv
Code i am using now is below
I have code (bit map method) using which i can print data grid but only one page not if grid has multiple pages(many rows)
i want to print all the rows around 90 +
Please help me with code to print dgv
Code i am using now is below
Code:
Private Sub btnprint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprint.Click
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.PrintPreviewControl.Zoom = 1
PrintPreviewDialog1.ShowDialog()
End Sub
Private Sub PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim bm As New Bitmap(Me.DataGridView1.Width, Me.DataGridView1.Height)
DataGridView1.DrawToBitmap(bm, New Rectangle(0, 0, Me.DataGridView1.Width, Me.DataGridView1.Height))
e.Graphics.DrawImage(bm, 0, 0)
End Sub
Comment