hi my program is need to print different forms but each forms must use different printer and all printers was connected to my pc via usb port, my problem is if i want to print a form A i will click the command box then it will use the EPSON printer, if form B use CANNON, and in form C it will use BROTHER as its default printer. Can u help me to set the dafault printer before the form will be printed. Thanks.

you just need the following

Dim p As VB.Printer
For Each p In VB.Printers
If p.DeviceName = "EPSON" Then
Set Printer = p
End If
Next

i hope that you can use the above code according to your suitability.one more thing that may help you is that use of commondialog boxe to choose the printer but i think the above code will be more suitable as we need not to select the printer again and agian whenever we want to print.

hope this helps you...

the work ESPON where that came from ?

Epson is a make of printer.
You put the name of the printer you want where it says Epson.

how can i determine the device name of the printers ?

For Operating Systems through Vista:
Click your start button.
If "Printers" is listed then click on it.

If "Printers" is not listed go to Control Panel and click Printers from Control Panel.

From the printers screen note the names of the available printer. Find the three you need and make sure you use the exact name listed under Printers.
Hope that helps.

you can easily determine the printers that are in your system
use the following code:-

Dim p As VB.Printer
For Each p In VB.Printers
MsgBox p.DeviceName
Next

you will get every printer name which is in your system.

hope this helps you . . .

BIG THANKS to all of you guys :D

if it really help you then please mark this thread solved . . .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.