Board index » Visual Studio » infinity loop in PrintPreviewDialog
|
catherinebodine
|
infinity loop in PrintPreviewDialog
Visual Studio120
Hi, I want to print some record(s) from dataset.table(tbname) using PrintPreviewDailog and PrintDocument. But It has a infinity loop error. I use a class to control the print procedure. Here is my code. Public Sub New(ByVal dbset As DataSet) jobFont = New Font("Times New Roman", 12) myJobSet = dbset pDoc = New PrintDocument() pDoc.DefaultPageSettings.Landscape = True AddHandler pDoc.PrintPage, AddressOf printJobSchedule pDialog.Document = pDoc pDialog.ShowDialog() End Sub 'PrintDocument Private Sub printJobSchedule(ByVal sender As Object, ByVal ev As PrintPageEventArgs) JobCount = myJobSet.Tables("Orders").Rows.Count reJob = myJobSet.Tables("Orders").Rows.Count yPos = 120 curJob = 0 JobPerPage =5 Do While JobCount>= 1 For count = 1 To jobPerPage 'Print some record(s) here curJob += 1 reJob -= 1 If reJob = 0 Then Exit For End If Next JobCount -= 5 If JobCount>0 Then ev.HasMorePages = True End If Loop End Sub IS my code got any mistake?? Thanks, KWOK - |
