так, я пытаюсь сделать программу, которая печатает страницы из базы данных доступа. I Создано evrything, и evrything работает нормально, чем я узнал, что мне нужно будет распечатать более одной страницы после исследование I обустроенной петли HasMorePages, я пошел думал, что это и попробовал много учебников, но это не идет хорошо , что я сделал этоVB.net HasMorePages Loop
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim Fontt As Font = New Drawing.Font("Time New Roman", 10)
Dim Font3 As Font = New Drawing.Font("Time New Roman", 12, FontStyle.Bold)
Dim Typp As Font = New Drawing.Font("Time New Roman", 30)
Dim Cred As Font = New Drawing.Font("Time New Roman", 20)
Dim Font2 As Font = New Drawing.Font("Time New Roman", 10, FontStyle.Bold)
If NumOrdre.Text = "Numero" Then
R = 170
TC = Nothing
TA = Nothing
C = Nothing
x = Nothing
L = Nothing
D = Nothing
F = Nothing
MT = Nothing
Q = Nothing
PR = Nothing
M = Nothing
NC = Nothing
Dim p As Integer
For i = 0 To ds.Tables(2).Rows.Count - 1
If Val(ComboBox1.Text) = Val(ds.Tables(2).Rows(i)("ID")) Then
p = i
Exit For
End If
Next
x = ds.Tables(2).Rows(p)("Client")
T = ds.Tables(2).Rows(p)("Datee")
NC = ds.Tables(2).Rows(p)("NumDoc")
F = "Bon De Livraison"
For Each row As DataRow In ds.Tables(1).Rows
If (R > e.MarginBounds.Bottom - 30) Then
R = 20
e.HasMorePages = True
Exit Sub
Else
e.HasMorePages = False
End If
If row.Item("NumDoc") = ds.Tables(2).Rows(p)("NumDoc") And row.Item("ClientFourni") = ds.Tables(2).Rows(p)("Client") Then
R = R + 30
L = row.Item("Ref")
Dim p2 As Integer
For i2 = 0 To ds.Tables("Articles").Rows.Count - 1
If L = ds.Tables("Articles").Rows(i2)("RefPerso") Then
p2 = i2
Exit For
End If
Next
D = ds.Tables("Articles").Rows(p2)("Dessi")
Dim p3 As Integer
For i3 = 0 To ds.Tables(1).Rows.Count - 1
If L = ds.Tables(1).Rows(i3)("Ref") And ds.Tables(1).Rows(i3)("NumDoc") = NC And ds.Tables(1).Rows(i3)("ClientFourni") = ds.Tables(2).Rows(p)("Client") Then
p3 = i3
Exit For
End If
Next
Dim p4 As Integer
For i4 = 0 To ds.Tables("Clients").Rows.Count - 1
If x = ds.Tables("Clients").Rows(i4)("Nom") Then
p4 = i4
Exit For
End If
Next
C = ds.Tables("Clients").Rows(p4)("Credit")
Q = ds.Tables(1).Rows(p3)("Quant")
PR = ds.Tables(1).Rows(p3)("PrixVente")
M = PR * Q
MT = MT + (PR * Q)
e.Graphics.DrawString(Q, Fontt, Brushes.Black, 581, R + 5)
e.Graphics.DrawString(D, Fontt, Brushes.Black, 140, R + 5)
e.Graphics.DrawString(L, Fontt, Brushes.Black, 32, R + 5)
e.Graphics.DrawString(PR, Fontt, Brushes.Black, 521, R + 5)
e.Graphics.DrawString(M, Fontt, Brushes.Black, 650, R + 5)
e.Graphics.DrawRectangle(Pens.Black, 130, R, 390, 30)
e.Graphics.DrawRectangle(Pens.Black, 31, R, 99, 30)
e.Graphics.DrawRectangle(Pens.Black, 520, R, 60, 30)
e.Graphics.DrawRectangle(Pens.Black, 580, R, 60, 30)
e.Graphics.DrawRectangle(Pens.Black, 640, R, 100, 30)
End If
Next row
e.Graphics.DrawString("Reférence", Font3, Brushes.Black, 32, 175)
e.Graphics.DrawRectangle(Pens.Black, 31, 170, 99, 30)
e.Graphics.DrawString("Total", Font3, Brushes.Black, 650, 175)
e.Graphics.DrawRectangle(Pens.Black, 640, 170, 100, 30)
e.Graphics.DrawString("Quant", Font3, Brushes.Black, 581, 175)
e.Graphics.DrawRectangle(Pens.Black, 580, 170, 60, 30)
e.Graphics.DrawString("Total", Font3, Brushes.Black, 550, R + 35)
e.Graphics.DrawRectangle(Pens.Black, 520, R + 30, 120, 30)
e.Graphics.DrawString(MT, Fontt, Brushes.Black, 650, R + 35)
e.Graphics.DrawRectangle(Pens.Black, 640, R + 30, 100, 30)
e.Graphics.DrawString(F, Typp, Brushes.Black, 280, 10)
e.Graphics.DrawString("Client :", Font3, Brushes.Black, 130, 75)
e.Graphics.DrawString("Numéro:", Font3, Brushes.Black, 130, 125)
e.Graphics.DrawString(NC, Fontt, Brushes.Black, 220, 125)
e.Graphics.DrawString("Date:", Font3, Brushes.Black, 450, 125)
e.Graphics.DrawString(T, Fontt, Brushes.Black, 530, 125)
e.Graphics.DrawString(x, Fontt, Brushes.Black, 220, 75)
e.Graphics.DrawString("Désignations", Font3, Brushes.Black, 140, 175)
e.Graphics.DrawRectangle(Pens.Black, 130, 170, 390, 30)
e.Graphics.DrawString("Prix", Font3, Brushes.Black, 531, 175)
e.Graphics.DrawRectangle(Pens.Black, 520, 170, 60, 30)
e.Graphics.DrawRectangle(Pens.Black, 120, 120, 600, 30)
e.Graphics.DrawRectangle(Pens.Black, 120, 70, 600, 30)
e.Graphics.DrawString("Crédit :", Font3, Brushes.Black, 450, 75)
e.Graphics.DrawString(C, Font3, Brushes.Black, 530, 75)
End If
End Sub
в результате я получаю, когда я пытаюсь напечатать, что петли HasMorePages не останавливается