473,394 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

PrintToPrinter command does not work on the web server?

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
--
Derek
Jun 14 '06 #1
1 2870
This turned out to be an ODBC problem. The DNS name on the server was
different to the name I used when developing the reports so it couldn't
connect to the server.
--
Derek
"Derek" wrote:
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
--
Derek

Jun 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bruno Alexandre | last post by:
Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under the recorset object.... how can I do this? I'm...
2
by: Alx Sharp | last post by:
Hello group! I'm facing a strange problem in the application I'm writing... I'm using crystal reports for printing sale receipts, and I wrote this lines of code: ...
0
by: Nicola George | last post by:
Hi all, I hope someone can help me as I'm going a bit metal with this problem. I have a project in ASP.NET, within this project I have Crystal Report called Catalogue. On an asp page I have a...
1
by: CAradhana | last post by:
hello all, I'm having problems printing to a network printer from the server using ASP.NET. I set the name of the printer using oRpt.PrintOptions.PrinterName = "\\\\server\\printer" and...
4
by: mike | last post by:
Printer - HP4300 in 3 different locations. VB.Net Calling crReportObject.PrintToPrinter(iRptCopies, True, 1, -1) doesn't always return. We have had at least 4 cases now where the printers...
0
by: Bill Nguyen | last post by:
I'm getting this error message trying to print to the local default printer (connected using a usb cable): "Analysis Server: Invlid printer specified" I have no problem printing to other network...
0
by: teddysnips | last post by:
I have two very similar applications running on the same development machine. One prints correctly, the other fails with an "Index out of range" exception. Here's the code for the one that...
13
by: ATJaguarX | last post by:
I have a Zebra S500 and multiple S600 label printers. http://www.zebra.com/id/zebra/na/en/index/products/printers/industrial_commercial/s600.html They are currently being used in our legacy...
4
by: RLN | last post by:
Re: Access 2003/WinXP Pro-SP3 I have a shell command that does not run correctly. I have two programs located on a file server: Pgm1.mdb and Pgm2.mdb Pgm1 launches Pgm2 via a command button...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.