|
Question : Printing mutipul pages VB.NET 2005
|
|
Hi
I am current trying to design a printed report for my application. In the subroutine below i am drawing my report. However i need to know how to insert a page break / start a new page. I am populating my page with data from a sql query. once i have reached a certain number of rows i want to be able to start a new page, i have tried adding e.hasmorepages = true after if rn>25 inside my while loop but this seams to generate an infinate number of pages all the same as the first. can anybody please help?
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage rn = 0 Try cnafm.Open() Dim notes1 As SqlDataReader = getnotes.ExecuteReader With notes1 If .HasRows Then While .Read If rn > 25 Then ?????e.hasmorepages=true????? rn = 0 End If fn = notes1(0).ToString g.DrawString(fn, arial, Brushes.Black, (e.MarginBounds.Left + 2), (e.MarginBounds.Top + 30) + (rn * 40)) rn=rn+1 End While End If End With Finally cnafm.Close() End Try
|
|
Answer : Printing mutipul pages VB.NET 2005
|
|
|
|
|
|