G
Guest
I am having problems with the PrintToPrinter command. It works fine in the
development environment but when I try using this on the web server it does
not work.
I am having problems debuging this because I get an error when my code hits
the msgbox command as well "Showing a modal dialog box or form when the
application is not running in UserInteractive mode is not a valid
opperation". I have a feeling this is because the code is in the page_load
sub.
Does anyone know why the PrintToPrinter command does not work?
This is my code.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim Stage As Integer = 0
Dim myPrintOptions As PrintOptions = NonJSDeliveryNote.PrintOptions
myPrintOptions.PrinterName = Session("Printer").ToString()
If Not IsPostBack Then
Try
NonJSDeliveryNote.PrintToPrinter(1, False, 0, 0)
Stage = 1
Response.Redirect("ShipSummary.aspx")
Exit Try
Catch ex As Exception
If Stage = 0 Then
MsgBox(ex.Message)
End If
End Try
End If
End Sub
development environment but when I try using this on the web server it does
not work.
I am having problems debuging this because I get an error when my code hits
the msgbox command as well "Showing a modal dialog box or form when the
application is not running in UserInteractive mode is not a valid
opperation". I have a feeling this is because the code is in the page_load
sub.
Does anyone know why the PrintToPrinter command does not work?
This is my code.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim Stage As Integer = 0
Dim myPrintOptions As PrintOptions = NonJSDeliveryNote.PrintOptions
myPrintOptions.PrinterName = Session("Printer").ToString()
If Not IsPostBack Then
Try
NonJSDeliveryNote.PrintToPrinter(1, False, 0, 0)
Stage = 1
Response.Redirect("ShipSummary.aspx")
Exit Try
Catch ex As Exception
If Stage = 0 Then
MsgBox(ex.Message)
End If
End Try
End If
End Sub