| re: infinity loop in PrintPreviewDialog
Hi, Cor
thanks for your sugestion, but I tried your code, It also
did a infinity loop. The infinity loop happened in
PrintPreviewDialog load a document.
here is my code
dim pDoc as PrintDocument
dim pDialog as new PrintPreviewDialog()
pDoc = New PrintDocument()
pDoc.DefaultPageSettings.Landscape = True
AddHandler pDoc.PrintPage, AddressOf printJobSchedule
pDialog.Document = pDoc
pDialog.ShowDialog()
[color=blue]
>-----Original Message-----
>Hi Kwok,
>I did test it with this code.
>It did not give an infinity loop.
>Maybe you can too bring your variables into the routine,[/color]
then you don't have[color=blue]
>the problem that maybe somewhere outside it can be change
>\\\\\\
>Dim JobCount As Integer = 1000
> Dim reJob As Integer = 100
> Dim curJob As Integer = 0
> Dim JobPerPage As Integer = 5
> Do While JobCount >= 1
> Dim count As Integer
> 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
> Dim dummy As Boolean = True
> End If
>//////////////
>Cor
>
>
>.
>[/color] |