Solved

Multiple Printers In VB

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now