DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   Printing in VB (http://www.daniweb.com/forums/thread201455.html)

jem00 Jul 3rd, 2009 9:00 am
Printing in VB
 
How do I print a particular label or textbox in visual basic?

By printing, I am referring to the actual hardcopy that comes out of a printer...haha

Thanks for your help.

Jem00

vb5prgrmr Jul 3rd, 2009 10:31 pm
Re: Printing in VB
 
The simple answer is...
Printer.Print Text1.Text


Good Luck

jem00 Jul 4th, 2009 1:05 am
Re: Printing in VB
 
haha so easy, yet soo sought after.

Thanks.

One more question, if there are multiple printers avaliable how can I select which one to print from?

vb5prgrmr Jul 4th, 2009 9:28 am
Re: Printing in VB
 
A couple of ways...
Dim P As Printer

Debug.Print Printer.DeviceName

For Each P In Printers
  Debug.Print P.DeviceName
  If P.DeviceName = "The Name of the printer" Then
    Set Printer = P
    Exit For
  End If
Next P

Debug.Print Printer.DeviceName
or by using the common dialog control
Debug.Print Printer.DeviceName

CD.ShowPrinter

Debug.Print Printer.DeviceName

Good Luck


All times are GMT -4. The time now is 4:07 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC