943,651 Members | Top Members by Rank

Ad:
Jul 3rd, 2009
0

Printing in VB

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
jem00 is offline Offline
29 posts
since Dec 2007
Jul 3rd, 2009
0

Re: Printing in VB

The simple answer is...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Printer.Print Text1.Text


Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jul 4th, 2009
0

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?
Reputation Points: 10
Solved Threads: 1
Light Poster
jem00 is offline Offline
29 posts
since Dec 2007
Jul 4th, 2009
0

Re: Printing in VB

A couple of ways...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim P As Printer
  2.  
  3. Debug.Print Printer.DeviceName
  4.  
  5. For Each P In Printers
  6. Debug.Print P.DeviceName
  7. If P.DeviceName = "The Name of the printer" Then
  8. Set Printer = P
  9. Exit For
  10. End If
  11. Next P
  12.  
  13. Debug.Print Printer.DeviceName
or by using the common dialog control
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Debug.Print Printer.DeviceName
  2.  
  3. CD.ShowPrinter
  4.  
  5. Debug.Print Printer.DeviceName

Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: creating a license ?
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Random color?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC