A
Andrew
Trying to print out a parts list on multiple pages and not sure exactly how
to do this. This is my code below as an attempt to do so.
'now going to load parts
'load connection
conn.ConnectionString = mdlMain.strConnString
conn.Open()
Dim sql As String = "select * from part_tbl"
e.PageSettings.Margins = New System.Drawing.Printing.Margins(50, 50,
50, 50)
Dim g As Graphics = e.Graphics
Dim rCount As Long = 0
Dim iPages As Long = 1
Dim iStartPoint As Long = 220
iGCount = 0
'Try
command = New System.Data.OleDb.OleDbCommand(sql, conn)
datareader = command.ExecuteReader
Do While datareader.Read
iGCount += 1
If MDIParent.iLastRecord > iGCount Then
If Not datareader.Item("part_itemnum") Is DBNull.Value Then
DrowRecText(e, 50, iStartPoint, 230, 30, 12, False,
fAlign.Left, Color.Black, Color.Blue, _
datareader.Item("part_itemnum"), False)
End If
End If
iStartPoint += 24
rCount += 1
If rCount = 30 Then
MDIParent.iLastRecord += rCount
e.HasMorePages = True
rCount = 0
Exit Sub
Else
e.HasMorePages = False
End If
System.Windows.Forms.Application.DoEvents()
Loop
g.Dispose()
'Catch ex As Exception
'Call mdlMain.LogError(ex.Message, sql)
'End Try
'-----------------------------------------------------------------------------------------
e.HasMorePages = False
conn.Close()
I am not sure how to print the rest of the data to the second page and so on..
to do this. This is my code below as an attempt to do so.
'now going to load parts
'load connection
conn.ConnectionString = mdlMain.strConnString
conn.Open()
Dim sql As String = "select * from part_tbl"
e.PageSettings.Margins = New System.Drawing.Printing.Margins(50, 50,
50, 50)
Dim g As Graphics = e.Graphics
Dim rCount As Long = 0
Dim iPages As Long = 1
Dim iStartPoint As Long = 220
iGCount = 0
'Try
command = New System.Data.OleDb.OleDbCommand(sql, conn)
datareader = command.ExecuteReader
Do While datareader.Read
iGCount += 1
If MDIParent.iLastRecord > iGCount Then
If Not datareader.Item("part_itemnum") Is DBNull.Value Then
DrowRecText(e, 50, iStartPoint, 230, 30, 12, False,
fAlign.Left, Color.Black, Color.Blue, _
datareader.Item("part_itemnum"), False)
End If
End If
iStartPoint += 24
rCount += 1
If rCount = 30 Then
MDIParent.iLastRecord += rCount
e.HasMorePages = True
rCount = 0
Exit Sub
Else
e.HasMorePages = False
End If
System.Windows.Forms.Application.DoEvents()
Loop
g.Dispose()
'Catch ex As Exception
'Call mdlMain.LogError(ex.Message, sql)
'End Try
'-----------------------------------------------------------------------------------------
e.HasMorePages = False
conn.Close()
I am not sure how to print the rest of the data to the second page and so on..