I get this error message: Object reference not set to an instance of an object
at the bolded line of this code:
Here is DrawDataGridView:Code:Public Sub MyPrintDocument_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles myprintdocument.PrintPage Dim more As New Boolean more = mydatagridviewprinter.DrawDataGridView(e.Graphics) If more Then e.HasMorePages = True End Sub
Any help solving this would be greatly appreciated. Thanks.Code:Public Function DrawDataGridView(ByRef g As Graphics) As Boolean Try Calculate(g) DrawHeader(g) Dim bContinue As Boolean = DrawRows(g) Return bContinue Catch ex As Exception MessageBox.Show("Operation failed: " + ex.Message.ToString(), Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Return False End Try End Function


Reply With Quote
