VB Crystal Report >> How do I set PrintOptions.PrinterName property?

by Stan » Tue, 20 Dec 2005 22:43:51 GMT

I am using Crystal Reports Engine to print the reports without loading them
into the Viewer.

There is more than one printer set up on the computer.

I need to set PrintOptions.PrinterName property in order to choose the right

I could not find anywhere in the documentation what exactly is "printer

I tried the name how it appears in Control Panel - Printers - that did not

What else can I try? Can I specify an IP address?



VB Crystal Report >> How do I set PrintOptions.PrinterName property?

by andy » Thu, 22 Dec 2005 17:40:26 GMT

User's default printer no good to you?
Most users expect changing their default printer to change what a
report will come out on.
Maybe it's cheques or something.


In design mode.
Right click on a blank part of the report.
Choose Designer then printer set up.
In this you'll see an example of the printer name.
Or, you could take a look in my network places and find some printers

The format is
"\\printserver\printer name"


VB Crystal Report >> How do I set PrintOptions.PrinterName property?

by Stan » Thu, 22 Dec 2005 21:15:48 GMT

I was missing server name

Instead of


I was putting

Printer (because it is a local printer)

Works now, thanks!

Similar Threads

1. question: set the PrinterName at .NET WinForm runtime, but the Printer dialong still showing - VB Crystal Report

2. setting printername and printtoprinter hanging

I was having the darndest time with a problem printing.

I created a Windows NT Service in .NET to periodically scan a queue for
firing off a separate console app via System.Diagnostics.Process for the
generation of cyrstal reports using the latest and greatest Crystal9 API.

Basically I would load the report from the network share and set the
database login properties for it and it's subreports then export it to a
file in RPT format.

The next step was to then take this exported report, reload it into a second
ReportDocument object, and then send it off to the designated network
printer via the PrintToPrinter method.

I would experience a hang on the assigning of the PrinterName property in
cases or the PrintToPrinter properties in other cases.

I was at a loss so tried changing the user account associated with my
NT Service (mentioned above).  Lo and behold, everything started working...

So I'm not exactly sure what was wrong with my original user account, but
solution was to delete that user's profile from the machine and then force
it to
be recreated by logging back in as that user.

When the profile was recreated in this fashion I set the user for the
Windows NT
Service back to what it was originally and now everything worked fine.

It makes no sense, but in my case, it was just a case where the profile for
the user
was bad and causing the Crystal Print Engine to fail.

If something similar to his happens for you, try a different user account
when printing
first and if that seems to fix it, you know there is something wrong with
the user
profile of your original user account.

3. Setting properties of a property in the Property Grid - VB.Net

4. setting properties via properties window during runtime

5. Setting property value to string or accessing property methods - VB.Net

6. IsInitializing Property (boolean) hangs on property set

I am upgrading an app from 6.0 to VB.

Have a couple of radio buttons that gave me the "may fire when form is
initialized" upgrade message. (no problem)

Added an Isinitializing property (boolean):

Private Property IsInitializing() As String


Return IsInitializing

End Get

Set(ByVal Value As String)

IsInitializing = Value

End Set

End Property


When I try to set this property as such:

Me.IsInitializing() = "True"


Me.IsInitializing = "False"


in the "new" method of my form class, I get an error, as the property gets
hung when it tries to set the "isinitialized" property to true:

"An unhandled exception of type 'System.StackOverflowException' occurred "

The hanging app is the property get routine....I debugged and tracked it
into the property set routine where it blows up for no apparent reason.

Any wisdom out there???

Frank Bachman
(Grumpy Aero Guy)

7. Set variable to property or call property - Visual Basic/VB

8. Custom Property - what am I doing wrong?

This is driving me crazy!  I have a .dot I'm using to create forms that 
connect to an Excel spreadsheet (to populate a userform drop down box).

I want to have three custom properties I can use anywhere in the document 
(one is for the path to the Excel data source, one is the location to save 
the completed forms and one is the location of the document template for 
opening new blank forms).

Two of my three custom properties work fine (data source and destination 
path).  I cannot get the document template location to work.  I want to have 
these set in one place so if we need to move/copy the form, data source or 
change the destination path, all we need to do is change the custom 
properties, not the code.

Here's my custom properties:
Name: SourceFile
Type: Text

Name: TemplateFile
Type: Text
Value: G:\GS-220\SLATE\CORRECTION_SHEETS\Correction_Sheet.dot

Name: CompletedDestination
Type: Text
Value: G:\GS-220\SLATE\CORRECTION_SHEETS\CompletedForms\

The SourceFile and CompletedDestination work fine, but the TemplateFile 
gives me a Run-time error 13, Type mismatch.

Here's the code where I call it from:

    CURRENTDOCNAME = ActiveDocument.FullName
    Word.Documents.Add ActiveDocument.CustomDocumentProperties("TemplateFile")

End Sub

Can anyone tell me what it is that I'm doing wrong?!?