Solved

Multiple Printers In VB

Posted on 2001-06-17
3
191 Views
Last Modified: 2011-04-14
Hi,
Another printing problem - I am writing a POS System and it requires use of both a Laser Printer and a Reciept Printer - I need each one to perform the task it is assigned to without selecting a printer each time for each task ie: Reciept Printer Prints Reciepts and the Laser prints reports - I used to know how to put all printers on the system into an array, but have long forgotten how to, any help will be appreciated - Best scenario is to get all system printers into a combo box.

Thanks,
Tom
0
Comment
Question by:flosoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 6200490
0
 
LVL 33

Accepted Solution

by:
hongjun earned 100 total points
ID: 6200495
To make you more convenient, I decided to post the code from the link here.

Private Sub Form_Load()
    PopulateListControlWithPrinters Combo1
End Sub

Private Function PopulateListControlWithPrinters(ListControl As _
Object) As Boolean

On Error GoTo errHandler:
Dim l As Long
Dim lCount As Long
ListControl.Clear

lCount = Printers.Count

If lCount = 0 Then
    ListControl.AddItem "(No Printer Installed)"
Else
    For l = 0 To lCount - 1
        ListControl.AddItem Printers(l).DeviceName
    Next
End If

PopulateListControlWithPrinters = True

Exit Function
errHandler:
PopulateListControlWithPrinters = False
Exit Function

End Function

hongjun
0
 

Author Comment

by:flosoft
ID: 6200756
Thanks for the code - Do you know if the combo box's item(#) corresponds exactly to the printers(#) number in the index? - Then all's I would have to save to the registry is the combo's selected index value.

Thanks again.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question