Hi, I'm trying to set any printer to be the Predeterminated in Windows.
The last time I had a problem getting the Printers of Windows. I have got that and there's no problem.
I get the Printers doing this
Code:
For Each PrinterLoader In Printers
frmMyPrinters.lstReceiptTicketPrinter.AddItem PrinterLoader.DeviceName
frmMyPrinters.lstInfoProductPrinter.AddItem PrinterLoader.DeviceName
frmMyPrinters.lstReportsPrinter.AddItem PrinterLoader.DeviceName
Next PrinterLoader
and save this selections using this
Code:
strReceiptPrinter = lstReceiptPrinter.Text
strInfoProductPrinter = lstInfoProductPrinter.Text
strReportsPrinter = lstReportsPrinter.Text
the Controls are contained in the form frmMyPrinters and are List Boxes
I fill the List Boxes to show them and the user can select the Printer to each activity is done in my programm
for example when I sell a Product I need to Print the information of the product and the Receipt at the same time.
I use the lstReceiptTicketPrinter.Text and the lstInfoProduct.Text to do this the .Text are the names of the printers.
An when i performe Reports I use the string variables
The three printers are Installed in the same PC including the four printer but i won't use that.
I set the Printer of the User-Selected-Printer doing this
Code:
Public Sub SetMyPrinter(MyPrinterName As String)
For Each MyPrinter In Printers
If MyPrinterName = MyPrinter.DeviceName Then
Set Printer = MyPrinter
End If
Next MyPrinter
End Sub
to call this procedure i do this
Code:
SetMyPrinter strReportsPrinter
dtrTicket.PrintReport
MyPrinterName in SetMyPrinter is the string of my Selected printer to perform the printing
and dtrTicket is my DataReport so I only call the Event of my DataReport, PrintReport
After this the Printing should be directed to my printer of the Receipts but it doesn't
I checked it after i SetMyPrinter the Printer.DeviceName is the same like the string argument.
So I realized that the printing is set to the Determinated Printer of Windows, so in this case is a Samsung SCX-4x16 Series, that is set like Predeterminated
And even if a try a lot of times seting any printer the printing is always send to that printer, but if a change the Predeterminated Printer in Windows to the ReceiptPrinter (EPSON TM-U220D Receipt) the printing is send to that printer.
So I need to perfome this
Change the Windows Predeterminated Printer every time I want to Printe the different Reports and Receipts because a Receipt and a Report must be printed at the same time.
I do this to do that with the strInfoProductoPrinter and the strReceiptPrinter
Code:
SetMyPrinter strInfoProductPrinter
dtrInfoProduct.PrintReport
SetMyPrinter strReceiptPrinter
dtrTicket.PrintReport
Here's a List of the Printers I have Installed:
Samsung SCX-4X16 Series (Predeterminated)
EPSON LX-300+ (This must be changed at Run-Time to be Predeterminated)
EPSON TM-U2220D Receipt (This must be changed at Run-Time to be Predeterminated)
HP PSC 1310 Series
I HOPE SOMEBODY CAN HELP ME, BECAUSE I´M WORRIED ABOUT THIS
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).