Question: Hello, I am running into the following errors while I am attempting to following the solution posted.PdPrint are giving the errors, I tried declaring them
Hello,
I am running into the following errors while I am attempting to following the solution posted.PdPrint are giving the errors, I tried declaring them as public objects. I've attached images and my code, thank you for your time and help.

rivate Sub pdPrint_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pdPrint.PrintPage 'print the header e.Graphics.DrawString("Employee Record." & Now.ToString, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 10) 'print the date and time e.Graphics.DrawString("Date and Time." & Now.ToString, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 38) 'print the employee data e.Graphics.DrawString("Last Name:" & lblLastName.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 80) e.Graphics.DrawString("First Name:" & lblFirstName.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 94) e.Graphics.DrawString("Middle Name:" & lblMiddleName.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 108) e.Graphics.DrawString("Employee Number:" & lblEmployeeNum.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 122) e.Graphics.DrawString("Department:" & lblDept.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 136) e.Graphics.DrawString("Telephone:" & lblTelephone.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 150) e.Graphics.DrawString("Extension:" & lblExtension.Text, New Font("Courier New", 10, FontStyle.Bold), Brushes.Black, 10, 178) End Sub
Private Sub mnuFilePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrint.Click pdPrint.Print() End Sub
End Sub 104 105 . 100 106 107 108 109 O references Private Sub mnuFilePrint Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrint.cl pdPrint Print X End Sub Exception Unhandled 1 x O references Private Sub mnuFileE System.NullReferenceException: 'Object variable or With block n.EventArgs) Handles muFileExit.clic 'close the form variable not set.' I Me.Close() End Sub Summar Events 110 111 * Shc 112 113 115 116 System.EventArgs) Handles mnuEditAddR Memory Tak CPU Usa O Rec 119 120 121 122 100% - O references Private Sub mnuedita Dim frmAdd As Ne 'create an insta 'determine if th If Not g_strFile 'close the f InputFile.ci 'display the No issues found This exception was originally thrown at this call stack: Microsoft.VisualBasic.Compiler Services. Symbols.Container Microsoft.VisualBasic.Compiler Services.NewLateBinding.Li Employee_Data.Form1.mnuFilePrint_Click(Object, System.EventA System.Windows.Forms.ToolStripltem.RaiseEvent(Object, S System.Windows.Forms.ToolStripMenultem.OnClick(Syste System.Windows.Forms.ToolStripltem.HandleClick(System System.Windows.Forms.ToolStripltem.HandleMouseUpisy Sustem.Windows.Forms. ToolStrinltem. FireFventInteractivel Ln: 107 Ch: 9 SPC CRLF Error List Entire Solution Code 0 Errors A 0 Warnings O 0 of 14 Messages XyBuild + IntelliSense - Description Project End Sub 104 105 . 100 106 107 108 109 O references Private Sub mnuFilePrint Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrint.cl pdPrint Print X End Sub Exception Unhandled 1 x O references Private Sub mnuFileE System.NullReferenceException: 'Object variable or With block n.EventArgs) Handles muFileExit.clic 'close the form variable not set.' I Me.Close() End Sub Summar Events 110 111 * Shc 112 113 115 116 System.EventArgs) Handles mnuEditAddR Memory Tak CPU Usa O Rec 119 120 121 122 100% - O references Private Sub mnuedita Dim frmAdd As Ne 'create an insta 'determine if th If Not g_strFile 'close the f InputFile.ci 'display the No issues found This exception was originally thrown at this call stack: Microsoft.VisualBasic.Compiler Services. Symbols.Container Microsoft.VisualBasic.Compiler Services.NewLateBinding.Li Employee_Data.Form1.mnuFilePrint_Click(Object, System.EventA System.Windows.Forms.ToolStripltem.RaiseEvent(Object, S System.Windows.Forms.ToolStripMenultem.OnClick(Syste System.Windows.Forms.ToolStripltem.HandleClick(System System.Windows.Forms.ToolStripltem.HandleMouseUpisy Sustem.Windows.Forms. ToolStrinltem. FireFventInteractivel Ln: 107 Ch: 9 SPC CRLF Error List Entire Solution Code 0 Errors A 0 Warnings O 0 of 14 Messages XyBuild + IntelliSense - Description Project
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
