I have written some code in the btnCheckStockStatus which prints out a list of stock items that need re-ordering based on whether the re-order level is greater than the current quantity, at the moment this code works successfully. I am now trying to write code so when i press the 'btnPrintStockStatus' its prints out what is in the btnCheckStockStatus, i tried to come up with some stuff but nothings really come close the the correct solution, any help or advice would be greatful!

Private Sub btnCheckStockStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckStockStatus.Click

        Dim increment As Integer = 0
        Dim quantity, reorderlevel As Integer
        Dim name As String

        MaxRows = KiwicyclesDataSet.Stock_Control.Rows.Count

        Dim reorderitems As String = ""

        For increment = 0 To MaxRows - 1

            quantity = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Quantity")
            reorderlevel = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Re-Order Level")
            name = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Model")

            If reorderlevel >= quantity Then
                reorderitems = reorderitems & name & vbCrLf
            Else
            End If
        Next

        MsgBox("The following items need to be restocked:" & vbCrLf & ReOrderItems)

    End Sub


    Private Sub btnPrintStockStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintStockStatus.Click
        PrintDocument1.Print()

    End Sub


    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage


        Dim increment As Integer = 0
        Dim quantity, reorderlevel As Integer
        Dim name As String

        MaxRows = KiwicyclesDataSet.Stock_Control.Rows.Count

        Dim reorderitems As String = ""
        For increment = 0 To MaxRows - 1

            quantity = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Quantity")
            reorderlevel = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Re-Order Level")
            name = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Model")

            If reorderlevel >= quantity Then
                reorderitems = reorderitems & name & vbCrLf
            Else
            End If
        Next






        Dim nameofpart
        Dim x, y As Integer
        Dim fontheight As Integer
        Dim index As Integer
        Dim myfont As New Font("Times New Roman", 12, FontStyle.Regular)
        fontheight = myfont.GetHeight(e.Graphics)

        x = 50
        y = 100
        nameofpart = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Model")
        e.Graphics.DrawString(nameofpart, myfont, Brushes.Black, x, y)
        y = y + fontheight

        e.Graphics.DrawString("", myfont, Brushes.Black, x, y)
        y = y + fontheight
        x = 100

        'For index = 0 to 
        '
        'e.Graphics.DrawString("", myfont, Brushes.Black, x, y)
        'y = y + fontheight
        'next index


    End Sub

Sorry, I'm not quite following the problem. My understanding from your description is that your have a problem with printing.

Suggestion : You could use CrystalReport or MicrosoftReport services.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.