Tom,
>While we are on the subject of printing, I am having trouble printing my
>barcode to a specific network printer. I can select a printer using the
>printer dialog, but I can't seem to use a stored printer name to direct
>my print job to correctly.
>
>In my code I have a variable called LblPrinter which has the name of the
>printer. I use the command:
>
>I := Printer.Printers.IndexOf(LblPrinter);
>
>If I >= 0 then Printer.PrinterIndex := I
> Else Showmessage('Using default Printer'); //Index is -1
>
>No matter what printer I select, I is always -1...;-(
>
>Any suggestions? When I use the PrinterDialog, I can see the correct
>Printer index number and the Printers name, but I can't seem to find it
>when I don't use the dialog.
Try outputing the list from Printer.Printers to the lines of a Memo, or any
other way where you can see them. I think you'll find that the name of the
printer om Printer.Printers is a little different than the name that is shown
in the common controls printer dialog. If you want to select the printer
from a stored printer name, you need to make sure you store the name
contained in Printer.Printers, not the printer dialog. This is easy to do. You
can have the user select the printer from the printer dialog, but then save
the name from Printer.Printers corresponding to the selected printer after
they have selected it.
Glenn Lawler
www.incodesystems.com