Possible reason:
-
PrintForm1
could be null
-
PrintForm1.PrinterSettings
could be null
-
PrintForm1.PrinterSettings.DefaultPageSettings
could be null.
Please check for null before you proceed.
Update 1:
Null Check in VB:
If PrintForm1 IsNot Nothing Then
End If
Nish's Guess:
PrintForm1 is null.
Try,
PrintForm1 = New PrintForm1
PrintForm1.PrinterSettings.DefaultPageSettings.Landscape = True
PrintForm1.Print()
Mark it as answer if it is helpful