Set Any Printer To Be The Predeterminated Printer
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
and save this selections using thisCode:For Each PrinterLoader In Printers frmMyPrinters.lstReceiptTicketPrinter.AddItem PrinterLoader.DeviceName frmMyPrinters.lstInfoProductPrinter.AddItem PrinterLoader.DeviceName frmMyPrinters.lstReportsPrinter.AddItem PrinterLoader.DeviceName Next PrinterLoader
the Controls are contained in the form frmMyPrinters and are List BoxesCode:strReceiptPrinter = lstReceiptPrinter.Text strInfoProductPrinter = lstInfoProductPrinter.Text strReportsPrinter = lstReportsPrinter.Text
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
to call this procedure i do thisCode: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
MyPrinterName in SetMyPrinter is the string of my Selected printer to perform the printingCode:SetMyPrinter strReportsPrinter dtrTicket.PrintReport
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
Here's a List of the Printers I have Installed:Code:SetMyPrinter strInfoProductPrinter dtrInfoProduct.PrintReport SetMyPrinter strReceiptPrinter dtrTicket.PrintReport
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
![]()
![]()
![]()
![]()






Reply With Quote