Newbie question

I am using Visual Studio 2005. I want to change an existing vb.net app so that printed output is routed to a non-default printer without any human intervention. The reason is that the non-default printer uses a different grade (and color) of paper.

I know the hostname and ip of the non-default printer that I want to use, so I was hoping I could loop thru a printers collection and saying
something like

for each ptr in printers
if ptr = 'ABC123' then
print using 'ABC123'
end if
next

.. however, I can't find a printers collection!

It's not a problem to add this special printer to each client, but the business requirement is that any OTHER printing (e.g. that is done using other applications) should CONTINUE to use the default printer.
I bring this up because I've seen some message boards where people advocate temporarily changing the default printer, doing the printing, and then quickly changing it back. Can't do that.

Thanks in advance for your assistance.

Comments

  • : I am using Visual Studio 2005. I want to change an existing vb.net app so that printed output is routed to a non-default printer without any human intervention. The reason is that the non-default printer uses a different grade (and color) of paper.
    :
    : I know the hostname and ip of the non-default printer that I want to use, so I was hoping I could loop thru a printers collection and saying
    : something like
    :
    : for each ptr in printers
    : if ptr = 'ABC123' then
    : print using 'ABC123'
    : end if
    : next
    :
    : .. however, I can't find a printers collection!
    :
    : It's not a problem to add this special printer to each client, but the business requirement is that any OTHER printing (e.g. that is done using other applications) should CONTINUE to use the default printer.
    : I bring this up because I've seen some message boards where people advocate temporarily changing the default printer, doing the printing, and then quickly changing it back. Can't do that.
    :
    : Thanks in advance for your assistance.
    :

    UPDATE: I found the answer myself but thought I should post it here unless somewhere else in the world (say, Bangalore) has the same question.Here is the code:

    dim strNonDefaultPrinter as string = "\ABC-123DEF456"
    Me.PrintDocument1.PrinterSettings.PrinterName = strNonDefaultPrinter

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion