Solved

Multiple Printers In VB

Posted on 2001-06-17
3
189 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

803 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